Reputation: 25
Any idea why this isn't working? When i run it it doesn't display anything.
$qry = mysql_query(" SELECT SUM(payment_received) AS total FROM Orders ");
{
$row = mysql_fetch_assoc($qry);
echo $row['total'];
}
Thanks for any help.
Upvotes: 0
Views: 81
Reputation: 1019
Correct your code with the following example
$qry = mysql_query("SELECT SUM(payment_received) AS total FROM Orders");
while ($row = mysql_fetch_assoc($qry)) {
{
echo $row["total"];
}
Upvotes: 1
Reputation: 586
$result = mysql_query("SELECT SUM(payment_received) AS total FROM Orders") or die(mysql_error());
$row = mysql_fetch_assoc($result);
print_r($row);
Upvotes: 1