adamjnz Posted April 10, 2006 Share Posted April 10, 2006 Is it possible to use PHP to sum some numbers for a table column?I am using dreamweavers "repeat region" feature to give a line total for each record in a db table. The line total isn't stored in the database it is calulated on the page. Is there a way to add a total at the the bottom of the column or am I trying to do the impossible? Link to comment https://forums.phpfreaks.com/topic/7015-solved-php-calculation-help-please/ Share on other sites More sharing options...
Yesideez Posted April 10, 2006 Share Posted April 10, 2006 Not in PHP but I believe the MySQL call you want is something like this:[code]$query=mysql_query("SELECT SUM(totals) FROM scores WHERE `player`='alive'");[/code] Link to comment https://forums.phpfreaks.com/topic/7015-solved-php-calculation-help-please/#findComment-25473 Share on other sites More sharing options...
adamjnz Posted April 10, 2006 Author Share Posted April 10, 2006 [!--quoteo(post=363271:date=Apr 10 2006, 11:54 PM:name=Yesideez)--][div class=\'quotetop\']QUOTE(Yesideez @ Apr 10 2006, 11:54 PM) [snapback]363271[/snapback][/div][div class=\'quotemain\'][!--quotec--]Not in PHP but I believe the MySQL call you want is something like this:[code]$query=mysql_query("SELECT SUM(totals) FROM scores WHERE `player`='alive'");[/code][/quote]But the values I want to sum arent in the DB, they are calculated by PHP on the actual page Link to comment https://forums.phpfreaks.com/topic/7015-solved-php-calculation-help-please/#findComment-25475 Share on other sites More sharing options...
kenrbnsn Posted April 10, 2006 Share Posted April 10, 2006 Can you post the code as it exists now?Ken Link to comment https://forums.phpfreaks.com/topic/7015-solved-php-calculation-help-please/#findComment-25506 Share on other sites More sharing options...
adamjnz Posted April 11, 2006 Author Share Posted April 11, 2006 [!--quoteo(post=363305:date=Apr 11 2006, 02:59 AM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Apr 11 2006, 02:59 AM) [snapback]363305[/snapback][/div][div class=\'quotemain\'][!--quotec--]Can you post the code as it exists now?Ken[/quote]Thanks but I have worked it out now Link to comment https://forums.phpfreaks.com/topic/7015-solved-php-calculation-help-please/#findComment-25714 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.