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 Quote Link to comment Share on other sites More sharing options...
Maq Posted January 4, 2011 Share Posted January 4, 2011 Is this in a database? Quote Link to comment Share on other sites More sharing options...
spaceman12 Posted January 4, 2011 Author Share Posted January 4, 2011 yes very much Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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.