owner Posted November 25, 2007 Share Posted November 25, 2007 How would you add up all the values in a column in the mySQL database. here is what I have. So the value returned would be 115. For the name of the column, it can be blah and the table is called red. Thanks, -Owner Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 25, 2007 Share Posted November 25, 2007 <?php $query = mysql_query("SELECT SUM(blah) as sum FROM table_name"); $row = mysql_fetch_assoc($query)or die(mysql_error()); echo $row['sum']; //will print out sum ?> Quote Link to comment Share on other sites More sharing options...
owner Posted November 26, 2007 Author Share Posted November 26, 2007 thanks much! 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.