thefreebielife Posted July 19, 2007 Share Posted July 19, 2007 Ostatus in the following is always a number: <?php $result2 = mysql_query("select * from users WHERE rid=$uid && ostatus>=1"); $count2=mysql_num_rows($result2); ?> How would I get it to total all ostatus? For example, one user might have 1, another with 4, so that would be a total of 5. You have <? echo "$count2"; ?> Credits So there it would echo the total amount of ostatus. Thank You Link to comment https://forums.phpfreaks.com/topic/60853-select-total-amount-of-a-table/ Share on other sites More sharing options...
chigley Posted July 19, 2007 Share Posted July 19, 2007 <?php $result2 = mysql_query("SELECT SUM(ostatus) FROM users WHERE rid= $uid && ostatus>=1") or die(mysql_error()); list($count2) = mysql_fetch_row($result2); echo "You have {$count2} Credits"; ?> Link to comment https://forums.phpfreaks.com/topic/60853-select-total-amount-of-a-table/#findComment-302783 Share on other sites More sharing options...
thefreebielife Posted July 19, 2007 Author Share Posted July 19, 2007 Haha easy enough Thanks Link to comment https://forums.phpfreaks.com/topic/60853-select-total-amount-of-a-table/#findComment-302787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.