Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/06/2010, 16:52
Ursulo
 
Fecha de Ingreso: mayo-2010
Mensajes: 212
Antigüedad: 13 años, 11 meses
Puntos: 3
resource(5) of type (mysql result)

Tengo los siguientes queries, de los cuales los dos han sido probados y dan resultados. Sin embargo, en ejecutando la pagina, el segundo query me devuelve NULL y eso hace que otros queries (omitidos en este caso) no funcionen.

$SelectEvento = "SELECT Id_evento, Id_cliente, Id_UDN, Fecha_evento, Costo_total FROM contra_eventos WHERE id_evento = $idEvento";
$resSelectEvento = @mysql_query($SelectEvento);
$rowSelectEvento = @mysql_fetch_row($resSelectEvento);


echo "<br/> SELECT EVENTO <BR/>";
echo $SelectEvento."<br/> TIPO DE RESULTADO <BR/>";
var_dump($resSelectEvento);
echo "<br/>ARREGLO RESULTANTE<BR/>";
var_dump($rowSelectEvento);


IF(!$resSelectEvento)
{
//echo @mysql_errno($result);
die('Invalid query(5): ' . @mysql_error());
}//Validacion de Insercion total

//$SelectCliente = "SELECT id_cliente FROM contra_cliente WHERE nombre = '$Datos[0]' AND apellido_paterno = '$Datos[1]' AND apellido_materno = '$Datos[2]' AND telefono = '$Datos[3]' AND rfc = '$Datos[4]'";
$SelectCliente = "SELECT id_cliente, nombre, apellido_paterno, apellido_materno, id_direccion, telefono, rfc FROM contra_cliente WHERE Id_cliente = $rowSelectEvento[1]";
$resSelectCliente = @mysql_query($SelectCliente);
$rowSelectCliente = @mysql_fetch_row($SelectCliente);
//$num_rows = mysql_num_rows($resSelectCliente);


echo "<br/> SELECT CLIENTE <BR/>";
echo $SelectCliente."<br/> TIPO DE RESULTADO <BR/>";
var_dump($resSelectCliente);
echo "<br/> ARREGLO RESULTANTE <BR/>";
var_dump($rowSelectCliente);


/*for($i=0;$i<=$num_rows;$i++)
{
echo $rowSelectCliente[$i];
}*/

IF(!$resSelectCliente)
{
//echo @mysql_errno($result);
die('Invalid query(6): ' . @mysql_error());
}//Validacion de Insercion total

El resultado de los echos es el siguiente:

SELECT EVENTO
SELECT Id_evento, Id_cliente, Id_UDN, Fecha_evento, Costo_total FROM contra_eventos WHERE id_evento = 1
TIPO DE RESULTADO
resource(4) of type (mysql result)
ARREGLO RESULTANTE
array(5) { [0]=> string(1) "1" [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(10) "2010-06-30" [4]=> string(4) "5000" }
SELECT CLIENTE
SELECT id_cliente, nombre, apellido_paterno, apellido_materno, id_direccion, telefono, rfc FROM contra_cliente WHERE Id_cliente = 1
TIPO DE RESULTADO
resource(5) of type (mysql result)
ARREGLO RESULTANTE
NULL
SELECT DIRECCION
SELECT id_direccion, calle, colonia, del_mun, estado FROM contra_direccion WHERE id_direccion =
TIPO RESULTADO
bool(false)
ARREGLO RESULTANTE
NULL Invalid query(7): 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 '' at line 1