dessolator Posted December 5, 2007 Share Posted December 5, 2007 How do I total up a column in php/mysql I need to total 2 columns up with about 30 values then create this if statement: if Yscore > Gscore echo "Y is the winner". Thanks, Ian Quote Link to comment Share on other sites More sharing options...
revraz Posted December 5, 2007 Share Posted December 5, 2007 This may help http://www.tizag.com/mysqlTutorial/mysqlsum.php Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 5, 2007 Share Posted December 5, 2007 <?php $query = mysql_query("SELECT SUM(fld1) as Yscore, SUM(fld2) as Gscore FROM table")or die(mysql_error()); $row = mysql_fetch_assoc($query); echo $row['Yscore']; echo $row['Gscore']; ?> Quote Link to comment Share on other sites More sharing options...
dessolator Posted December 5, 2007 Author Share Posted December 5, 2007 Thanks very much guys, much appreciated 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.