jmr3460 Posted March 23, 2010 Share Posted March 23, 2010 I have a table that has different values on each row and I need to add the values from each row from one field column. I have tried using a while loop to loop through all the rows and everything echos but I am not sure how to add the values of each row together. Can someone point me in the right direction? Quote Link to comment https://forums.phpfreaks.com/topic/196194-adding-values-from-mysql-field-column/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 23, 2010 Share Posted March 23, 2010 How about let the database engine do it in the query - http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_sum No slow parsed, tokenized, interpreted php code is needed. Quote Link to comment https://forums.phpfreaks.com/topic/196194-adding-values-from-mysql-field-column/#findComment-1030308 Share on other sites More sharing options...
jmr3460 Posted March 23, 2010 Author Share Posted March 23, 2010 Thank you very much. I guess I need to not only try and learn about php functions but if I am going to use mysql maybe it would be beneficial to learn some mysql functions. I am truly Grateful. Quote Link to comment https://forums.phpfreaks.com/topic/196194-adding-values-from-mysql-field-column/#findComment-1030314 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.