ho migliorato un pò le cose aggiungendo un if
Codice PHP:
function deleteImage()
{
if (isset($_GET['productId']) && (int)$_GET['productId'] > 0) {
$productId = (int)$_GET['productId'];
} else {
header('Location: index.php');
}
if ($deleted = _deleteImage($productId)) {
// update the image and thumbnail name in the database ITALIANO
$sql = "UPDATE tbl_project
SET prj_image = '', prj_thumbnail = ''
WHERE prj_id = $productId";
dbQuery($sql)or die(mysql_error());
} else {
$deleted_fr = _deleteImage_fr($productId);
// update the image and thumbnail name in the database FRANCESE
$sql_fr = "UPDATE tbl_project_fr
SET prj_image_fr = '', prj_thumbnail_fr = ''
WHERE prj_id = $productId";
dbQuery($sql_fr)or die(mysql_error());
}
header("Location: index.php?view=modify&productId=$productId");
}
adesso cosa succede:
se elimino la 1a immagine, ok funziona, la 2a img resta. mentre se cerco di eliminare la 2a, mi elimina la 1a e la 2a rimane. devo cliccare di nuovo sulla 2a per eliminarla.