Salve a tutti
ho realizzato un db (al momento solo una lista) di articoli, ci ho messo dentro anche una funzione di delete, ma non funge e non riesco a capire dove sta il problema:
Codice PHP:
<?php
$dbm = new dbmanager();
if ($dbm->open()) {
if ($rs = $dbm->query("SELECT * FROM articoli INNER JOIN stato ON
articoli.idstato=stato.id INNER JOIN argomento ON articoli.idargomento=argomento.id")) {
?>
<form action="pubblicazioni.php" method="post">
<table summary="" width="99%" cellspacing="2"
cellpadding="2" border="1" align="center">
<thead>
<tr>
<th></th>
<th width="42%">
<font color="#FE9900">Titolo</font>
</th>
<th width="27%">
<font color="#FE9900">Autori</font>
</th>
<th width="87%">
<font color="#FE9900">Stato</font>
</th>
<th width="9%">
<font color="#FE9900">Data</font>
</th>
<th width="8%">
<font color="#FE9900">Rivista</font>
</th>
<th width="5%">
<font color="#FE9900">Argomento</font>
</th>
</tr>
</thead>
<?php
while ($row = $dbm->fetch($rs)) {
echo '<tr><td align="justify">'
.'<input type="checkbox" name="da_cancellare[]" value="'
.$row['id'].'" />'
.'</td><td align="center">'.$row['titolo']
.'</td><td align="center">'.$row['autore']
.'</td><td align="center">'.$row['data']
.'</td><td align="center">'.$row['tipo']
.'</td><td align="center">'.$row['supporto']
.'</td><td align="center">'.$row['campo']
.'</td></tr>';
}
?>
</table>
<?php
} else {
echo "Non ho trovato nessun articolo.";
}
}else{
echo "Si e' verificato un errore durante la connessione con il database.";
}
?>
<?php
if ($_SERVER['REQUEST_METHOD']=='POST') {
$id_list = $_REQUEST['da_cancellare'];
foreach ( $id_list as $id ) {
$dbm->query("DELETE FROM 'articoli' WHERE id='$id'");
}
$dbm->close();
}
?>
<input type="submit" name="elimina" value="Elimina Articolo" alt=
"Elimina" title="Elimina elemento" src="add.png" />
</form>