View Single Post
Old 01-17-2010, 07:11 PM  
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
php/mysql question, counting number of * results if something = something

Let's say I have a mysql table called john with several duplicate 'status' columns and I run the query:

$res2 = mysql_query("SELECT * FROM john WHERE status='1'");
$row2 = mysql_fetch_assoc($res2);


How do I declare how many results there are with this IP? For example if the table had 11 entries with the status=1, how do I declare $total_status = 11 (11 will be changed to the code I need to calculate this)

Hope this isn't to confusing, if so let me know and I will post a better example. I basically want to declare how many columns there are with the status of 1.

Last edited by mkx; 01-17-2010 at 07:20 PM..
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote