Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2009, 08:22
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Error haciendo UPDATE en campo datetime

Saludos, tngo un sistema el cual se trata d una lista de invitados que deben confirmar su asistencia por lo cual ellos seleccionan si van o no van y se hace un UPDATE en la tabla correspondiente pero a su vez hago un update en el campo fecha que es de tipo datetime y cuando hago el update me dice esto

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '09:08:58, status=1 WHERE id=1' at line 1

mis codigos son
invitaciones.php
Código PHP:
<?php
require_once('includes/sesion.php');
include(
'conect.php');

$reco "-1";
if (isset(
$_SESSION['id'])) {
    
$reco $_SESSION['id'];
}

$sql="select * from invitados where id = '$reco'";
$sql_exec mysql_query($sql);
$rec mysql_fetch_array($sql_exec);

$confirma=$rec['status']; 

$hoy date("Y-m-d, H:m:s");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>::: Bienvenidos</title>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="css/estilos.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="723" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="417" height="144" align="right" valign="top" background="imgs/home_upleft.jpg"><table width="200" border="0" cellpadding="0" cellspacing="3" class="verdana-gris-peq">
      <tr>
        <td>Bienvenido
          <?php echo $rec['nombre'];?>
          </span>
          <?php echo $rec['apellido'];?><?php print_r($hoy);?></td>
      </tr>
    </table><br /></td>
<td width="306" rowspan="2" valign="top">
<script type="text/javascript">
<!--
AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','306','height','600','src','right','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','right' ); //end AC code
-->
</script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="306" height="600">
          <param name="movie" value="right.swf" />
          <param name="quality" value="high" />
          <embed src="right.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="306" height="600"></embed>
        </object>
        </noscript>
        </td>
  </tr>
  <tr>
    <td valign="top"><table width="417" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3"><img src="imgs/invitaciones_titulo.jpg" width="417" height="78" /></td>
      </tr>
      <tr>
        <td width="30"><img src="imgs/invitaciones1.jpg" width="30" height="290" /></td>
        <td width="364" valign="top" background="imgs/invitaciones_back.jpg">
        <?php if ($confirma == 2) { ?>
        <!-- -->
        <form id="form2" name="form2" method="post" action="confirmar.php" enctype="multipart/form-data">
          <table align="center" class="textoINDEX">
            <tr valign="baseline" class="textoprincipal">
              <td colspan="2" align="right" nowrap="nowrap"><input type="hidden" name="fecha" value="<?php echo $rec['fecha'?>" /></td>
              </tr>
            <tr valign="baseline" class="textoprincipal">
              <td colspan="2" align="right" nowrap="nowrap">
                <select name="status"  class="textoINDEX">
                  <option value="0">Seleccione</option>
                  <option value="1">Si</option>
                  <option value="2">No</option>
                </select> </td>
            </tr>
            <tr valign="baseline">
              <td align="right" nowrap="nowrap" class="textoprincipal">&nbsp;</td>
              <td><div align="left"></div></td>
            </tr>
            <tr valign="baseline">
              <td align="right" nowrap="nowrap" class="textoprincipal">&nbsp;</td>
              <td><input type="submit" class="textoINDEX" value="Actualizar" /></td>
            </tr>
          </table>
          <!--input type="hidden" name="id" value="<?php #echo $row_Recordset1['id']; ?>" /-->
          <input type="hidden" name="MM_update" value="form2" />
          <input type="hidden" name="id" value="<?php echo $rec['id'?>" />
        </form>
        <!-- -->
        <?php ?></td>
        <td width="23"><img src="imgs/invitaciones2.jpg" width="23" height="290" /></td>
      </tr>
      <tr>
        <td colspan="3"><img src="imgs/invitaciones3.jpg" width="417" height="64" /></td>
      </tr>
    </table></td>
  </tr>
</table>
<a href="invitaciones.php">invitaciones link temporal</a>
</body>
</html>
confirmar.php
Código PHP:
<?php
require_once('Connections/cersol.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;
}


if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {

    
$updateSQL sprintf("UPDATE invitados SET fecha=%s, status=%s WHERE id=%s",
    
GetSQLValueString($_POST['fecha'], "datetime"),
    
GetSQLValueString($_POST['status'], "int"),
    
GetSQLValueString($_POST['id'], "int"));

    
mysql_select_db($database_cersol$cersol);
    
$Result1 mysql_query($updateSQL$cersol) or die(mysql_error());

    
$updateGoTo "invitacionconf.php";
    if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= ( strpos($updateGoTo'?') ) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
    }


    if ( 
headers_sent() ) die('sent');
    
header('Location: ' $updateGoTo);
    exit;
}
?>
alguien ve el error???
si pueden ayudarme les agradeceria d verdad...
Saludos
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...