spaceman12 Posted January 4, 2011 Share Posted January 4, 2011 Hello guys, suppose belows is a table and i'm trying to count all the non empty cells for each column. However, when I tried to do so, it always return 6 and I fail to accomplish the condition I so desired to execute. Please help me. user1 user2 user3 123 345 343 435 355 555 545 555 Thank you Link to comment https://forums.phpfreaks.com/topic/223407-count/ Share on other sites More sharing options...
Maq Posted January 4, 2011 Share Posted January 4, 2011 Is this in a database? Link to comment https://forums.phpfreaks.com/topic/223407-count/#findComment-1154851 Share on other sites More sharing options...
spaceman12 Posted January 4, 2011 Author Share Posted January 4, 2011 yes very much Link to comment https://forums.phpfreaks.com/topic/223407-count/#findComment-1154856 Share on other sites More sharing options...
shlumph Posted January 4, 2011 Share Posted January 4, 2011 What do you have for a query so far? select count(id) where user1 is not null or user2 is not null or user3 is not null Link to comment https://forums.phpfreaks.com/topic/223407-count/#findComment-1154858 Share on other sites More sharing options...
spaceman12 Posted January 4, 2011 Author Share Posted January 4, 2011 $locateREF="SELECT COUNT($uin) FROM referral_system WHERE $uin IS NOT NULL"; $getREF=mysql_query($locateREF); $fetch=mysql_fetch_row($getREF); $total=$fetch[0]; echo $total; Here $uin is for any user Link to comment https://forums.phpfreaks.com/topic/223407-count/#findComment-1154863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.