...

View Full Version : Php querying mysql !!



wap3
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 ??

:thumbsup:

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


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


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

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

Just what I was after !!

:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum