我正在尝试从表LastResult中获取 SnappersScore列的总和。但是,输出中根本没有任何内容。甚至没有错误。关于我做错了什么的任何想法?
这里是:
<?php
mysql_connect(xxxxxx);
if (mysql_connect_errno())
{
echo "Failed to connect to MySQL: " . mysql_connect_error();
}
$result = mysql_query('SELECT SUM(SnappersScore) AS TotalGoals FROM LastResult');
$row = mysql_fetch_assoc($result);
$sum = $row['TotalGoals'];
echo $sum;
?>