我正在尝试对 SQL 数据库中的多个字段求和。这些字段被称为第 1 周到第 13 周,因为它们存储每周的结果。我现在有这个但是它没有输出任何东西,任何帮助将不胜感激。干杯
<?php
if ($resultsRows == 0){
echo '<p> No results have been listed for you yet. </p>';
}
if ($resultsRows > 0){
$qrytotalresult = "SELECT SUM(week1 + week2 + week3 + week4 + week5 + week6 + week7 + week8 + week9 + week10 + week11 + week12 + week13) FROM results WHERE username = '$username'";
$TotalResult = mysql_query($qrytotalresult);
return $TotalResult;
}
?>