RE: [PHP] Counting

From: Date: Mon, 17 Sep 2001 21:44:05 +0000
Subject: RE: [PHP] Counting
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-67647@lists.php.net to get a copy of this message
> I'm using php/mysql. I want to be able to count the number of records that > match something. > I've used mysql_num_rows() and it does work, but is there a better way? > Something like COUNT(*)? I've tried to use it, but all I get is Resource ID > #1 or something similar. Any ideas for the best way to do this? > > Max $result = mysql_db_query($database, "SELECT COUNT(*) AS count FROM table;"); $count = mysql_fetch_array($result); echo $count["count"]; Luboslav Gabal

« previous php.general (#67647) next »