Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/05/2010, 09:16
colino
 
Fecha de Ingreso: agosto-2009
Mensajes: 80
Antigüedad: 14 años, 8 meses
Puntos: 0
Otra vez el count

Teniendo esta tabla
CREATE TABLE IF NOT EXISTS `prueba` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=21 ;

INSERT INTO `count` (`id`, `nombre`) VALUES
(19, 'miguel'),
(20, 'claudia');

Como ven tiene tan solo dos filas.
Cuanto hago este simple select el count me devuelve 4. Aunque tenga más filas siempre devuelve 4, excepto cuanto está vacio que devuelve 1 cuando debería devolver 0,

$selec="select * from prueba";
$cons=mysql_query($selec);
$subcategoria1=mysql_fetch_array($cons);

echo count($subcategoria1);
echo '<br/>';
do{
echo $subcategoria1['nombre'];
echo '<br/>';
}while($subcategoria1=mysql_fetch_array($cons));

Por que pasa esto?