Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/05/2011, 00:01
berserkerhacker
 
Fecha de Ingreso: mayo-2011
Ubicación: Almeria (España)
Mensajes: 51
Antigüedad: 13 años
Puntos: 3
error al realizar una consulta a mysql

Hola, el otro dia deje un post en mysql y me dicen que no tiene ningun error
sintactico... pero el error sigue estando.. haber si me podeis ayudar porfavor.

el codigo que me da el 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();
    
?>
porfavor espero que puedan ayudarme ,

saludos.