我正在尝试将MySQL查询生成的值加在一起,但我得到的总数似乎并没有加起来。这是我的代码:
$top_score = mysql_fetch_array(mysql_query("SELECT 1ET FROM scoring_data WHERE
Competition='$competition' AND Club='$row[Club]' AND Team='$row[Team]' ORDER BY
1ET DESC LIMIT 0, 3"));
echo (array_sum($top_score)/10) ;
我在1ET中为特定查询(比赛,俱乐部和球队)输入了两个值:6和3.我得到的总数是9,但总数是12 ......
感激不尽的任何建议!
答案 0 :(得分:0)
数组的结构不符合您的预期:
print_r($top_score);
也许在查询中这样做:
SELECT SUM(1ET)/10 AS top_score FROM scoring_data WHERE
Competition='$competition' AND Club='{$row['Club']}' AND Team='{$row['Team']}'
ORDER BY 1ET DESC LIMIT 0, 3