Ver Mensaje Individual
  #4 (permalink)  
Antiguo 06/02/2008, 09:00
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: cantidad de registros en una tabla, duda con sentencia COUNT(*)

Puedes hacer una funcion:
Código PHP:
function totalRegistros$tabla ) {
      global 
$db_link;
      
$sqlTotal mysql_query("SELECT COUNT(*) FROM $tabla"$db_link) or die(mysql_error());
      
$row mysql_fetch_row($sqlTotal);
      return 
$row[0];

y asi solo tendrias que llamarla por tabla:
Código PHP:
$totalNoticias totalRegistros("noticias");
$totalCommentarios totalRegistros("comentarios");
// etc. 
Saludos.

Última edición por GatorV; 07/02/2008 a las 08:46 Razón: Mistype