View Full Version : Php querying mysql !!

11-15-2002, 02:04 AM
Hey everyone

If I have a simple query such as

select name from tableone where name = whatever

How can I add on a count to the end of it. In other word have something that counts the reords returned and puts that value into a variable, e.g $counttotal

Any help appreaciated ??


11-15-2002, 12:23 PM
Here's one way.

$result=mysql_query("SELECT count(name) FROM tableone WHERE name=whatever",$linID);

I believe there's also a mysql_num_rows which gives you the total rows returned from a result set.

11-15-2002, 03:09 PM
Thanks bcarl

Just what I was after !!