Hola a todos.
Tengo un problema con la web que estoy haciendo. El script es el siguiente. El problema está en el último header que debería redireccionar a la página anterior una vez se hace el borrado en la base de datos. A ver si me podeis ayudar, gracias !!!
--------------------------------------------------------
<?php require_once('../../Connections/quartconn.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;
}
/* ------------------------------------------------------- */
$maxRows_DetailRS1 = 20;
$pageNum_DetailRS1 = 0;
$nombre_fichero = "sinimagen.jpg";
if (isset($_GET['pageNum_DetailRS1'])) {
$pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
mysql_select_db($database_quartconn, $quartconn);
$recordID = $_GET['recordID'];
$query_DetailRS1 = "SELECT * FROM `11_actividades` WHERE id = $recordID";
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $quartconn) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
$nombre_fichero = $row_DetailRS1['imagen'];
$directori_fotos = "/home/quartdep/public_html/doc/fotos/";
if (strlen($nombre_fichero)>1) {
unlink($directori_fotos.$nombre_fichero);
}
if (isset($_GET['totalRows_DetailRS1'])) {
$totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
$all_DetailRS1 = mysql_query($query_DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
/* ------------------------------------------------------ */
if ((isset($_GET['recordID'])) && ($_GET['recordID'] != "")) {
$deleteSQL = sprintf("DELETE FROM 11_actividades WHERE id=%s",
GetSQLValueString($_GET['recordID'], "int"));
mysql_select_db($database_quartconn, $quartconn);
$Result1 = mysql_query($deleteSQL, $quartconn) or die(mysql_error());
$anterior=$_GET["anterior"];
$deleteGoTo = "$anterior";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: /home/%s", $anterior));
//Header("Location: /home/".$anterior);
exit;
}