ciao a tutti,
come posso cancellare tutti i record e le rispettive immagini presenti nel database? (vedi allegato)
codice:
$evento = $_GET['evento'];
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT * FROM gallery WHERE evento=$evento";
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if(file_exists("../../images/galley/$row_Recordset1[foto]") ) {
unlink("../../images/galley/$row_Recordset1[foto]");
} else { echo "il file $ro[file] non esiste"; }
$deleteSQL = "DELETE FROM gallery WHERE evento=$evento";
$Result1 = mysql_query($deleteSQL, $conn) or die(mysql_error());
$deleteGoTo = "gallery.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
cosi dovrei cancellarne una giusto?
Grazie mille