Hola queria pedir ayuda con mi codigo php que me da este error 
 Código HTML:
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Archivos de programa\EasyPHP 3.0\www\reservas\vaciaIp.php on line 28
 y por mas que miro el num_rows, no le encuentro el fallo y la query la ago en el phpmyadmin y me va bien. si alguien encuentra el error se lo agredeceria. 
un saludo    
 Código PHP:
    
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
 
  <HEAD>
    <META http-equiv="content-type" CONTENT="text/html; charset=UTF-8">
    <LINK REL="stylesheet" href="estilo.css" type="text/css">
    <META name="description" CONTENT="ventanilla electrónica, indice">
    <META NAME="keywords" CONTENT="">
    <META http-equiv="Content-Language" CONTENT="es">
    <LINK REL="icono" href="/favicon.ico" />
    <TITLE>ventanilla electrónica, índice</TITLE>
  </HEAD>
 
<?php
session_start();
include("../../data/.LdR.inc");
$logged_in = $_SESSION['logged_in'];
if( $logged_in ) {
$dblink = mysql_connect($hostDB, $usuDB, $pwdDB);
mysql_set_charset("utf8");
mysql_select_db($nameDB, $dblink);
$fecha  = strftime("%Y/%m/%d", time());
$result = mysql_query("
        SELECT    direccionIP,nIntentos,tipo, MAX(fechaHora) AS fechaHora, COUNT(*) AS nIntentos
        FROM    listanegraips
        GROUP BY direccionIP
        ORDER BY fechaHora DESC, direccionIP,nIntentos
        ");
$num = mysql_num_rows($result);
?>
  <BODY>
 
    <DIV ID="barra1">
      <DIV ID="espacio1">
        <DIV ID="logo">
    
        </DIV>
      </DIV>
    </DIV>
    <?php
    #include '';
    ?>
    <DIV ID="contenido">
      <DIV ID="centro">
        <DIV CLASS="galeria">
          <DIV CLASS="encabezado"><h4>Lista de IPs fallidas:</h4>
          </DIV>
 
      </DIV>
    <table align="center" border="0" width="70%"  bgcolor="white">
  <tr>
 <td align="center" colspan="4"><font color="black" size="4">Hay <B><?php echo $num?></B> entrada<?php
 if ($num!= 1) echo "s";?> en la lista (<a href="bloquearIP.php">añadir</a>)</font></td>
 </tr>
  <td align="center"  bgcolor="#89DEED"><b>IP/Tipo</b></td>
  <td align="center" bgcolor="#89DEED"><b>Fecha</b></td>
  <td align="center"  bgcolor="#89DEED"><b>Intentos</b></td>
  <td align="center"  bgcolor="#89DEED"><b>Vaciar Lista</b></td>
<?php
#
$i = 0;
while ( $i<$num ):
  $direccionIP = mysql_result($result, $i, 'direccionIP');
  $tipo = mysql_result($result, $i, 'tipo');
  $nIntentos = mysql_result($result, $i, 'nIntentos');
  $fechaHora = mysql_result($result, $i, 'fechaHora');
   if ( $nIntentos>=$limiteIntentos ) {
     $color = "Red";
     $bloqueada = TRUE;
    } else {
     $color = "#A9F5A9";
     $bloqueada = FALSE;
    }
?>
<strong>
 <tr bgcolor="<?php echo $color?>">
  <td align="center"><?php echo $direccionIP?>/<?php echo $tipo ?></td>
  <td align="center"><?php echo $fechaHora?></td>
  <td align="center"><?php echo $nIntentos?></td>
  <td align="center"><a href="accionResetIP.php?IP=<?php echo $direccionIP?>"onclick="return confirm('             ¿Realmente desea desbloquear Ip:<?php echo $direccionIP?>?')"> <?php if ( $bloqueada ) echo          "desbloquear"; else echo       "liberar";?></a></td>
 </tr>
</strong>
<?php
  $i++;
endwhile;
?>
           <tr>
           <td align="center" colspan="4">        <?php
  if (isset($_GET["mensaje"])) {
    $mensaje=$_GET['mensaje'];
    echo "<strong><font color='#00CC00'>$mensaje<br></font></strong>";
  }
?></td>
           </tr>
           
        </table>
 
 
      </DIV>
      
    </DIV>
 
 
 
  </BODY>
</HTML>
<?php
}
else header       // authentication failed: display login form
?>