Foros del Web » Programando para Internet » PHP »

Problema con query was empty

Estas en el tema de Problema con query was empty en el foro de PHP en Foros del Web. ¿Que significa eso? Ya le eh puesto error_reporting arriba de todo ( me dijieron que ais mostraba un error, ) , per no mostro error: ...
  #1 (permalink)  
Antiguo 26/10/2007, 22:26
 
Fecha de Ingreso: julio-2006
Mensajes: 254
Antigüedad: 17 años, 9 meses
Puntos: 0
Problema con query was empty

¿Que significa eso?

Ya le eh puesto error_reporting arriba de todo ( me dijieron que ais mostraba un error, ) , per no mostro error:

El codigo es:

La parte que esta con rpoblemas esmarcada en rojo ;)

Cita:
<?php
# FileName="o.o"
# Type="o.o"
# HTTP="o.o"
$hostname_neoparty = "io.o";
$database_neoparty = "io.o";
$username_neoparty = "io.o";
$password_neoparty = "o.o";
$neoparty = mysql_pconnect($hostname_neoparty, $username_neoparty, $password_neoparty) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
error_reporting(E_ALL);

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

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


if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = mysql_query("INSERT INTO usuarios (nombre,usuario,contraseña,email,genero,partypoint s,user_neo) VALUES ('{$_POST['nombre']}','{$_POST['usuario']}','{$_POST['contrasea']}','{$_POST['email']}','{$_POST['genero']}','{$_POST['partypoints']}','{$_POST['user_neo']}')",$neoparty);




mysql_select_db($database_neoparty, $neoparty);
$Result1 = mysql_query($insertSQL, $neoparty) or die(mysql_error());

$insertGoTo = "/correctamente.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!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>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
body {
background-color: #EEAD0E;
}
a:link {
color: #0000FF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #0000FF;
}
a:hover {
text-decoration: none;
color: #0000FF;
}
a:active {
text-decoration: none;
color: #0000FF;
}
.Seccion {
font-family: "Comic Sans MS";
font-size: 12px;
color: #0000FF;
}
.Estilo3 {font-size: 18px}
.Estilo4 {font-size: 14px}
.Estilo7 {font-family: "Comic Sans MS"; font-size: 12px; color: #0000FF; font-weight: bold; }
.Estilo8 {font-size: 9px}
-->
</style>
</head>

<body>

<p align="center" class="Seccion Estilo3">Registrate!</p>

<p align="center" class="Seccion Estilo3">&nbsp;</p>
<p align="center" class="Seccion Estilo4">Seras registrado en el momento!</p>
<p align="center" class="Seccion Estilo4">&nbsp;</p>
<p align="center" class="Seccion Estilo4">&nbsp;</p>

<form action="<?php $editFormAction ?>" method="post" name="form1" class="Seccion" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Usuario:</td>
<td><input type="text" name="usuario" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Contraseña:</td>
<td><input type="text" name="contrasea" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Genero:</td>
<td><input type="text" name="genero" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Partypoints:</td>
<td><input name="partypoints" type="hidden" id="hiddenField" value="5" />
Se agregaran 5</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">User en neo:</td>
<td><input type="text" name="user_neo" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input type="submit" value="Insertar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
<p align="center" class="Seccion Estilo4">&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="Seccion">&nbsp;</p>
<p class="Seccion">&nbsp;</p>
<p align="right" class="Seccion">&nbsp;</p>
</body>



</html>

Agradeceria mucho al que me ayudara

Última edición por lauchalp95; 26/10/2007 a las 22:29 Razón: 1) Olvide agradecer 2) Se que parte esta acutando mal y lo marcocon color
  #2 (permalink)  
Antiguo 27/10/2007, 03:15
Avatar de Aken  
Fecha de Ingreso: julio-2004
Ubicación: Barcelona
Mensajes: 267
Antigüedad: 19 años, 9 meses
Puntos: 1
Re: Problema con query was empty

Para que te muestre el error... crea o edita el fichero .htaccess de la raiz, y ponle la directiva

php_value display_errors 1

Saludos ;)
  #3 (permalink)  
Antiguo 27/10/2007, 03:42
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Re: Problema con query was empty

El error es que ejecutás la query dos veces... primero la guardas en $insertSQL y después en $Result1 ejecutás la query con el resource que tenías antes... Me parece que la primera vez no querés ejecutar la query, sino formar el string con la consulta

Código PHP:
$insertSQL "INSERT INTO usuarios (nombre,usuario,contraseña,email,genero,partypoint s,user_neo) VALUES ('{$_POST['nombre']}','{$_POST['usuario']}','{$_POST['contrasea']}','{$_POST['email']}','{$_POST['genero']}','{$_POST['partypoints']}','{$_POST['user_neo']}')";
mysql_select_db($database_neoparty$neoparty);
$Result1 mysql_query($insertSQL$neoparty) or die(mysql_error()); 
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:21.