AsiaUnderworld Posted April 1, 2009 Share Posted April 1, 2009 Hi, im trying to get php to sum the total of figures in a row in my database the row is called msgtotal and table called user_stats , in the row msg total, theres one value 3, one of 1, then the rest are currently 0 , so the total should be 4, however it always says its 1 heres my code.. $sql2 = ("SELECT forumposts,msgtotal FROM user_stats"); $sql2 = mysql_query($sql2) or die(mysql_error()); $total_messages = mysql_fetch_assoc($sql2); and then echo the following <?=number_format(count($total_messages['msgtotal']))?> Link to comment https://forums.phpfreaks.com/topic/152112-solved-php-count-php-sum/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.