How To Count Number Of Rows In Mysql Database Query

RegisterLogin
How To Count Number Of Rows In Mysql Database Query
Post Description: How To Count Number Of Rows In Mysql Database Query
Tags: How, To, Count, Number, Of, Rows, In, Mysql, Database, Query
This Post Was Posted On Apr 26, 2008 By Webune #1499
lets say you want to find out how many users you have that are registered..

for example, i have a table called users and a field called confirmed and i want to do a query of the number of users who have been confirmed

this is an example query i would use

PHPCODE:
$sql = "SELECT username FROM users WHERE confirmed='yes'";
$result = mysql_query($sql ,$db);
$confirmedusers= mysql_num_rows($result);


as you can see, the mysql_num_rows() functions does this trick well
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2012 Webune Forums - Fri Dec 14, 2012 5:49 am
Powered by: Webune Forums V3