Comunidad de diseño web y desarrollo en internet online

Problema al enviar fecha por GET

Citar            
MensajeEscrito el 12 May 2008 03:13 pm
Hola! Nada primero deciros que me estoy iniciando en el tema de PHP. La duda que tengo es que cuando quiero enviar una fecha en formato dd/mm/yyyy a otra pagina no consigo hacerlo, me sigue saliendo en formato sql. :molesto: :

Os lo muestro:

Código :

<?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));
}
?>


En el siguiente apartado es dnd tengo el problema, que es que no se si lo estoy pasando bien, x lo demas todo me va bien.

Código :

$deleteGoTo = \\\"calendario.php?id_aulas=\\\".$_GET[\\\'id_aulas\\\'].\\\"&fecha=\\\".cambiaf_a_normal(date(\\\"d/m/Y\\\", $hoy));


Espero vuestra respuesta, Muchas Gracias de antemano.

Por xeron

5 de clabLevel



 

firefox
Citar            
MensajeEscrito el 12 May 2008 04:54 pm
¿Podrías poner el código de la función cambiaf_a_normal()?

Por Necrophasto

Claber

148 de clabLevel



Genero:Masculino  

Diseñador gráfico y web

opera

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.