I have to resurrect the article that I marked solved this am, 'cause it ain't!
My code is:
<?php
if(isset($_POST['chest'])){
$pin=$_COOKIE['registered'];
$game=$_POST['item'];
foreach($game as $rep){
$link=sqlite_open('data/'.$pin.'.sqlite ',0666,$sqliteerror);
sqlite_query($link,"INSERT INTO holding (item)
VALUES('$rep')");
sqlite_query($link,"UPDATE players SET points = points+10");
header('location:entrance.php');
}
}
include('php/head.php');
?>
<div class="game">
<p><u>Chest</u></p>
<p> The chest has several items inside,<br>
A Food parcel, a small pocket knife, a long scarf, a torch
and a key on a ring.
</p>
<form action="" method="post">
<div class='form'>
<fieldset>
<legend>Choose Items To Keep</legend>
<div class='labels'>
<?php
$res=sqlite_query($link,"SELECT * FROM chest ");
while($row=sqlite_fetch_array($res)){
$cont=explode(",",$row['item']);
foreach($cont as $item){
echo ucwords($item)."<br>";
}
}
?>
</div>
<div class='input'>
<input type='checkbox' name='item[]' value='food'><br>
<input type='checkbox' name='item[]' value='knife'><br>
<input type='checkbox' name='item[]' value='torch'><br>
<input type='checkbox' name='item[]' value='scarf'></br>
<input type='checkbox' name='item[]' value='key'></br>
</div>
<div class='send'>
<input type='submit' name='chest' value='Keep'>
</div>
</fieldset>
</div>
</form>
</div>
now, what I wan't to do is, after the insert query on line 7, use the '$rep' variable to delete the same items from the 'chest' table, (line 28),or use array_diff to make a new array so I can update the 'chest' table.
I'v tried every combination of array functions etc that I can think of or find, but I bet I've missed the one that works eh?