Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/02/2013, 07:00
alejandromaringomez
 
Fecha de Ingreso: abril-2010
Mensajes: 267
Antigüedad: 14 años, 1 mes
Puntos: 1
Error en consulta

Hola ,
He hecho este código con el fin de poder recojer el numero de usuarios registrados:
En el configuracion.php:
Código:
<?php
@define(USER,'root');
@define(PASS,'');
@define(SERVER,'localhost');
@define(BASEURL,'http://localhost/chat/');
@define(DATABASE,'users');
?>
Y cuando llamo al archivo , recojo los datos del msql .
En el de incio:
Código:
<?php 
require_once('class_users/configuracion.php');
$host = SERVER;
$db = DATABASE;
$usuario = USER;
$password = PASS;
mysql_connect($host,$usuario,$password);
mysql_select_db($db);
$tabla = mysql_query("select * from users");
$registrados = mysql_num_rows($tabla);
print_r $registrados ;
?>
Y me da..

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /homepages/21/d407259815/htdocs/wsb6818340901/chat/index.php on line 12