Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/05/2012, 02:33
omar0989
 
Fecha de Ingreso: mayo-2012
Ubicación: df
Mensajes: 12
Antigüedad: 12 años
Puntos: 0
Exclamación Problema con Query en PHP

Hola tengo un problema con la siguiente sentencia:

Código PHP:
$updateSQL sprintf("UPDATE Usuarios SET Nombre=%s, NIP=%s, E_mail=%s, Extension=%s WHERE Ficha= %s",
                       
GetSQLValueString($_POST['Nombre'], "undefined"),
                       
GetSQLValueString($_POST['NIP'], "text"),
                       
GetSQLValueString($_POST['E_mail'], "text"),
                       
GetSQLValueString($_POST['Extension'], "text"),
                       
GetSQLValueString(trim($_POST['Ficha']),"int"));

  
mysql_select_db($database_Pases2$Pases2);
  
$Result1 mysql_query($updateSQL$Pases2) or die(mysql_error()); 
que arroja el siguiente error: 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 ' NIP='1234, E_mail='1234, Extension='1234 WHERE Ficha= 1234' at line 1

Ese ' APOSTROFE que esta en rojo despues de Ficha = 1234 es el error pero no se en qeu momento lo pone. alguien que me pueda ayudar y de antemano gracias.

Los valores estan bien definidos pero adjunto el codigo para mayor referencia:
Código PHP:
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