me explico.. tengo un panel de control en el cual me me muestra un panel panel de ingreso de imagenes y debajo de la misma me muestra las fotos que estan cargadas para X producto.. y esas imagenes tienen la opcion a la vez de eliminar, es decir, en el mismo panel para ingreso tiene la opcion de ver las fotos y de eliminarlas... pero cuando elimino una foto este regresa al mismo formulario tomando en el URL el id de la foto... como hago para q esto no pase????
lo idal seria q volviera al mismo producto...
en la pagina de eliminar hice algo asi.. pero me devuelve al producto de id = 1 y no al relacionado con la imagen seleccionada
Código PHP:
<?php require_once('../Connections/alba.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
mysql_select_db($database_alba, $alba);
$query_Recordset2 = "SELECT prod_id FROM galeria";
$Recordset2 = mysql_query($query_Recordset2, $alba) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
if ((isset($_GET['id'])) && ($_GET['id'] != "")) {
$deleteSQL = sprintf("DELETE FROM galeria WHERE id=%s",
GetSQLValueString($_GET['id'], "int"));
mysql_select_db($database_alba, $alba);
$Result1 = mysql_query($deleteSQL, $alba) or die(mysql_error());
$deleteGoTo = "http://www.indexa.com.ve/albarracin/admin/ing_img_prod.php?id=".$row_Recordset2['prod_id'];
/* if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}*/
header(sprintf("Location: %s", $deleteGoTo));
}
?>
<?php
mysql_free_result($Recordset2);
?>