talk2toyin Posted October 12, 2012 Share Posted October 12, 2012 (edited) Here's my source code please..... $sql = "select c_load from accndi_i"; $res = mysql_query($sql); while($credits = mysql_fetch_assoc($res)) { while($currentcredit = each($credits)) { echo $currentcredit["value"]."+"; } } /*but, what i really want is to sum up the values fetched from my c_load column in my accndi_i table. Assistance urgently needed please. Thanks */ Edited October 12, 2012 by talk2toyin Quote Link to comment https://forums.phpfreaks.com/topic/269407-i-need-help-with-suming-up-integer-data-values-fetch-from-my-database/ Share on other sites More sharing options...
mikosiko Posted October 12, 2012 Share Posted October 12, 2012 use mysql SUM() function http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_sum and if that doesn't help... a practical example http://www.tizag.com/mysqlTutorial/mysqlsum.php Quote Link to comment https://forums.phpfreaks.com/topic/269407-i-need-help-with-suming-up-integer-data-values-fetch-from-my-database/#findComment-1384904 Share on other sites More sharing options...
talk2toyin Posted October 12, 2012 Author Share Posted October 12, 2012 Wow! Thanks alot. It worked out just fine. The funny thing is, I know of that sum function....but I just never crossed my mind I could apply it there. Thanks again, u're a life saver. Quote Link to comment https://forums.phpfreaks.com/topic/269407-i-need-help-with-suming-up-integer-data-values-fetch-from-my-database/#findComment-1384905 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.