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 :/ Link to comment https://forums.phpfreaks.com/topic/194576-very-small-problem-help-pleasequick/ 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 .""; Link to comment https://forums.phpfreaks.com/topic/194576-very-small-problem-help-pleasequick/#findComment-1023332 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); } Link to comment https://forums.phpfreaks.com/topic/194576-very-small-problem-help-pleasequick/#findComment-1023424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.