Os lo muestro:
Código PHP:
<?php require_once('../Connections/BDreservas.php'); ?>
<?php
$hoy = date("d/m/Y");
function cambiaf_a_normal($fecha) /*funcion para convertir la fecha de formato americano a europeo */
{
ereg( "([0-9]{2,4})/([0-9]{1,2})/([0-9]{1,2})", $fecha, $mifecha);
$lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1];
return $lafecha;
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
if ((isset($_GET['id_aulas'])) && ($_GET['id_aulas'] != "") && (isset($_GET['id_turno'])) && ($_GET['id_turno'] != "") && (isset($_GET['fecha'])) && ($_GET['fecha'] != ""))
{
$deleteSQL = sprintf("DELETE FROM reservas WHERE id_aulas=%s AND id_turno=%s AND fecha=%s",
GetSQLValueString($_GET['id_aulas'], "int"),
GetSQLValueString($_GET['id_turno'], "int"),
GetSQLValueString($_GET['fecha'], "date"));
mysql_select_db($database_BDreservas, $BDreservas);
$Result1 = mysql_query($deleteSQL, $BDreservas) or die(mysql_error());
$deleteGoTo = "calendario.php?id_aulas=".$_GET['id_aulas']."&fecha=".cambiaf_a_normal(date("d/m/Y", $hoy));
if (isset($_SERVER['QUERY_STRING']))
{
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>
Código PHP:
$deleteGoTo = "calendario.php?id_aulas=".$_GET['id_aulas']."&fecha=".cambiaf_a_normal(date("d/m/Y", $hoy));