tengo un codigo que me da este error:
Código:
  
( ! ) Notice: Trying to get property of non-object in C:\wamp\www\Blog\ES\index.php on line 58
Call Stack
#	Time	Memory	Function	Location
1	0.0012	678200	{main}( )	..\index.php:0
( ! ) Fatal error: Call to a member function fetch_assoc() on a non-object in C:\wamp\www\Blog\ES\index.php on line 62
Call Stack
#	Time	Memory	Function	Location
1	0.0012	678200	{main}( )	..\index.php:0

  este es el codigo php:Código PHP:
   <?php     
     $db = new mysqli('localhost', 'user', 'pass', 'blogdb'); //conexion a base de datos (host, usuario, contraseña, base datos)
     
     $query = "select articulos.articulid, articulos.nombrees, articulos.fecha, articulos.tipo, articulos.resumenes, articulos.ranking from articulos";
     $result = $db->query($query);
 
     $num_results = $result->num_rows;  //linea 58 linea 58 linea 58
     
     for ($i=0; $i < 20; $i++)
     {
         $row = $result->fetch_assoc(); //linea 62 linea 62 linea 62
         echo ($i+1);
         echo stripslashes($row['nombrees']);
     }
     
     $result->free();
     $db->close();
    ?>    



 ,saludos.


 
 


