RE: [PHP-DB] How to find out the number of rows in a table?

From: Date: Thu, 24 Jan 2002 21:37:50 +0000
Subject: RE: [PHP-DB] How to find out the number of rows in a table?
Groups: php.db 
Request: Send a blank email to php-db+get-16155@lists.php.net to get a copy of this message
Try the following: $sql = "select count(*) as c from your_table" ; $result = mysql_query(your_db, $sql, your_connection_identifier) ; $row_count = mysql_result($result, 0, 'c') ; Now $row_count contains the number of rows in your table named "your_table" HTH --Sam Masiello "Andy" <news.letters@gmx.de> wrote in message news:20020124163715.20612.qmail@pb1.pair.com... > Hi there, > > I am trying to find out the number of rows in a table. The mysql docu says > there is a mysql_num_rows statement but it requiers a sql statement in > front. How could I do this more efficiently? Can anybody make an example, > please? I am sure that there is an more easy way. > > Cheers Andy > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#16155) next »