Foros del Web » Programando para Internet » PHP »

Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resour

Estas en el tema de Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resour en el foro de PHP en Foros del Web. Estimados: Cuando tenía un sitio web en Windows no me envíaba errores, ahora que pasamos a Linux nos pasa el siguiente error "Warning: mysql_num_rows(): supplied ...
  #1 (permalink)  
Antiguo 14/07/2009, 16:28
 
Fecha de Ingreso: febrero-2008
Ubicación: Santiago - Chile
Mensajes: 42
Antigüedad: 16 años, 1 mes
Puntos: 0
Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resour

Estimados:

Cuando tenía un sitio web en Windows no me envíaba errores, ahora que pasamos a Linux nos pasa el siguiente error "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ..... "

El código es el siguiente

Código:
<?	
$cnnList = mysql_connect($CONN_HOST, $CONN_USER, $CONN_PASS); 
mysql_select_db($CONN_DATABASE, $cnnList);

$strSQL = "SELECT ID_Obra, Obra, Foto "
 . "FROM tbObras "
 . "WHERE Mostrar = '1' AND FechaEntrega = '0000-00-00' "
 . "ORDER BY FechaInicio LIMIT 0, " . MAXOBRASPORTADA . ";";
 
$rstList = mysql_query($strSQL, $cnnList);

if (mysql_num_rows($rstList) > 0) {
?>
  <table width="250" border="0" cellspacing="8" cellpadding="0">
	<tr>
<?
  $i = 0;
  while ($recList = mysql_fetch_assoc($rstList)) {
	if (($i % MAXOBRASPORFILAPORTADA) == 0) {
	  echo "</tr><tr>";
	}
    $i++;
	$lngID_Obra = $recList["ID_Obra"];
	$strObra = $recList["Obra"];
	$strFoto = $recList["Foto"];
?>
	  <td width="50%" valign="top"><table border="0" cellpadding="2" cellspacing="0" class="destacados">
		<tr valign="top">
		  <td width="108" height="60" bgcolor="#F0F0F0"><a href="obras/ver_obra.php?id=<?= $lngID_Obra ?>"><img src="thumb.php?img=<?= UPLOAD_DIR_OBRAS . "/" . $strFoto ?>&w=108&h=60" alt="<?= str_replace('"', '&quot;', $strObra) ?>" width="108" height="60" hspace="4" vspace="4" border="1" style="border-color: #000000;" /></a></td>
		</tr>
		<tr valign="top">
		  <td><img src="imagenes/estructura/icono-destacados.gif" width="19" height="11" /><a href="obras/ver_obra.php?id=<?= $lngID_Obra ?>"><?= $strObra ?></a></td>
		</tr>
	  </table></td>
<?
  }
?>
	</tr>
  </table>
<?
} else {
?>
	<p class="texto">No se ha encontrado nuevos proyectos.</p>
<?
}
mysql_close ($cnnList);
?>
¿Saben como solucionarlo?
  #2 (permalink)  
Antiguo 14/07/2009, 16:30
 
Fecha de Ingreso: agosto-2006
Mensajes: 179
Antigüedad: 17 años, 8 meses
Puntos: 0
Respuesta: Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL re

Ese es un error en la sintaxis del SQL. Luego del sql dale:

echo mysql_errno($cnnList )." : ".mysql_error($cnnList );

Tambien puedes imprimir el SQL, puede ser que te falte una variable.

Espero te sirva.
  #3 (permalink)  
Antiguo 14/07/2009, 16:53
 
Fecha de Ingreso: febrero-2008
Ubicación: Santiago - Chile
Mensajes: 42
Antigüedad: 16 años, 1 mes
Puntos: 0
Respuesta: Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL re

Pero si en Windows funcionaba perfectamente, ahora que lo cambiamos a Linux dejo de funcionar.
  #4 (permalink)  
Antiguo 14/07/2009, 16:54
 
Fecha de Ingreso: agosto-2006
Mensajes: 179
Antigüedad: 17 años, 8 meses
Puntos: 0
Respuesta: Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL re

Exacto, pero imprime el SQL, la configuracion del PHP puede estarlo afectando, por ejemplo puede ser la directiva register_globals, si manejas variables directamente esto se ve afectado.

Prueba y avisa.
  #5 (permalink)  
Antiguo 15/07/2009, 00:24
 
Fecha de Ingreso: febrero-2008
Ubicación: Santiago - Chile
Mensajes: 42
Antigüedad: 16 años, 1 mes
Puntos: 0
Respuesta: Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL re

Estimado, haría lo que tu me dices pero no se casi nada, en realidad nada de PHP
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:01.