Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/03/2012, 16:08
emcon
 
Fecha de Ingreso: agosto-2010
Mensajes: 3
Antigüedad: 13 años, 8 meses
Puntos: 0
Error de Mysql y PHP

Bueno, mi problema esta en que no soy muy experimentado en el tema de programacion con PHP y Mysql, estoy aprendiendo a los ponchasos, ja, siempre fui creyente que se aprende mejor equivocandose. Bueno resulta que necesito hacer un formulario de envio de datos de usuario, lo estoy haciendo en dreamweaver con PHP y Mysql, tengo todo hecho, la conoexion a la base de datos, y el form para enviarlo, pero al momento de dar click en el boton de envio, me salta 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 '±a) VALUES (NULL, 'asdasd', 'asd', NULL, 0, NULL, NULL, NULL)' at line 1

doy por sentado que el error viene dado por los valores que le estoy dando a los campos pero bue, como dije no se donde modificar el codigo. Aca abajo ingreso el codigo que me genera la base de datos en PhpMyadmin

================================================== ========


<?php require_once('Connections/Registro.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO regstrousuarios (IdUsuario, Nombre, Apellido, Direccion, Telefono, Email, Usuario, Contraseña) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['IdUsuario'], "int"),
GetSQLValueString($_POST['Nombre'], "text"),
GetSQLValueString($_POST['Apellido'], "text"),
GetSQLValueString($_POST['Direccion'], "text"),
GetSQLValueString($_POST['Telefono'], "int"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Usuario'], "text"),
GetSQLValueString($_POST['Contrasea'], "text"));

mysql_select_db($database_Registro, $Registro);
$Result1 = mysql_query($insertSQL, $Registro) or die(mysql_error());

$insertGoTo = "reg_exitoso.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>

================================================== =======

aca tambien dejjo el link de una pagina con la cual me guie para hacer la conexion y la creacion del formulario para ingresar los datos....

http://cyberexplorador.wordpress.com/2010/03/27/consultar-insertar-y-modificar-registros-de-una-base-de-datos-de-mysql-con-php-sin-programar-nada/


================================================== =======

saludos, espero puedan ayudarme.