Allora ragazzi ora ho fatto così, in lista_nozze.php
Codice PHP:
echo '<form action="elimina.php" method="post">';
while ($result = mysql_fetch_array($query))
{
$id = $result['ID'];
$cod = $result['COD'];
$oggetto = $result['OGGETTO'];
$prezzo = $result['PREZZO'];
$venduto = $result['VENDUTO'];
echo '<table>
<tr>
<td>'.$cod.'</td>
<td>'.$oggetto.'</td>
<td>'.$prezzo.'</td>
<td>'.$venduto.'</td>
<td><input type="checkbox" name="id[]" value="'.$id.'"></td>
<td><input type="submit" value="Elimina Oggetto"></td>
</tr>
</table>';
}
echo '</form>';
e in elimina.php ho fatto così:
Codice PHP:
<?php
include('connessione.php');
if(is_array($_POST['id']))
{
foreach($_POST['id'] as $idz)
{
mysql_query("DELETE FROM ".$_GET['lista']." WHERE ID = '$idz'") or die(mysql_error());
}
}
echo 'Oggetto eliminato';
?>
L'id lo riconosce solo che mi da quest'errore:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ID = '1'' at line 1
Soluzioni??