3raser Posted March 9, 2010 Share Posted March 9, 2010 Have to go soon... require("settings.php"); //extract $extract = mysql_query("SELECT * FROM users"); $numrows = mysql_num_rows($extract); while ($row = mysql_fetch_assoc($extract)) { $total = 0; $overall = $row[frpcash] + $total; echo "Total FrP cash: ". $overall .""; } Result: "Total FrP cash: 10Total FrP cash: 10" But it should say 20, AND the text is messed up :/ Quote Link to comment Share on other sites More sharing options...
sasa Posted March 9, 2010 Share Posted March 9, 2010 try require("settings.php"); $extract = mysql_query("SELECT * FROM users"); $owerall = 0; while ($row = mysql_fetch_assoc($extract)) $overall += $row['frpcash']; echo "Total FrP cash: ". $overall .""; Quote Link to comment Share on other sites More sharing options...
trq Posted March 9, 2010 Share Posted March 9, 2010 Or better still. require("settings.php"); if ($result = mysql_query("SELECT SUM(frpcash) FROM users")) { echo "Total FrP cash: " . mysql_result($result, 0); } 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.