Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/08/2008, 12:37
Avatar de jotaincubus
jotaincubus
 
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 19 años
Puntos: 394
Respuesta: Problema modificando registo

Cuando imprimo las variables me muestra concatenadamente lo que se selecciono en los lista menu (2008-08-22) pero no actualiza en la base de datos, solo me modifica todo a (0000-00-00).

Modifique el codigo tal como Taldreakan me indico pero el problema persiste, no se si el problema sea por la funcion. Vuelvo a colocar el codigo con la funcion completa.

Código:
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;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
// manejo de variables de fecha enviadas por el formulario
$f_inicio = $f_in_year."-".$f_in_mes."-".$f_in_dia;
$f_fin = $f_fin_year."-".$f_fin_mes."-".$f_fin_dia; 
// fin de variables de fecha enviadas por el formulario
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE reg_event SET nit=%s, titulo=%s, descripcion=%s, Lugar=%s, entrada=%s, tipo1=%s, ciudad=%s, f_inicio=%s, f_fin=%s WHERE id=%s",
                       GetSQLValueString($_POST['nit'], "int"),
                       GetSQLValueString($_POST['titulo'], "text"),
                       GetSQLValueString($_POST['descripcion'], "text"),
                       GetSQLValueString($_POST['Lugar'], "text"),
                       GetSQLValueString($_POST['entrada'], "int"),
                       GetSQLValueString($_POST['tipo1'], "int"),
                       GetSQLValueString($_POST['ciudad'], "text"),
                       GetSQLValueString('$f_inicio', "date"), // insersion de fecha sin post
                       GetSQLValueString('$f_fin', "date"), // insersion de fecha sin post
                       GetSQLValueString($_POST['id'], "int"));
Muchisimas gracias por sus respuestas...
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???