shadiadiph Posted August 1, 2010 Share Posted August 1, 2010 Slight query I have a database that has my online users in it how can i add something to it where the 'username' field is thesame for example $getusers=''; $getusers="SELECT * FROM `tblonline` WHERE `usertype`='user'"; I need something to filter out if the user has opened two browsers and is logged in for example 'username'='john' might appear twice in the table but I only want to count it once with the num_rows query Quote Link to comment https://forums.phpfreaks.com/topic/209493-returning-a-count-from-a-table-but-not-including-where-one-field-is-the-same/ Share on other sites More sharing options...
FuThAr Posted August 1, 2010 Share Posted August 1, 2010 you can group your results by username, then count them in the way you prefer $getusers="SELECT * FROM `tblonline` WHERE `usertype`='user' GROUP BY `username` "; it will give you one result per-user logged Quote Link to comment https://forums.phpfreaks.com/topic/209493-returning-a-count-from-a-table-but-not-including-where-one-field-is-the-same/#findComment-1093807 Share on other sites More sharing options...
shadiadiph Posted August 2, 2010 Author Share Posted August 2, 2010 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/209493-returning-a-count-from-a-table-but-not-including-where-one-field-is-the-same/#findComment-1094040 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.