我正在尝试计算数据库“阶段”表中“容量”列的总和。这是我正在使用的代码:
$result = mysql_query('SELECT SUM(capacity) AS total_capacity FROM stages');
$row = mysql_fetch_assoc($result);
$sum = $row['total_capacity'];
但是这个错误被称为:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in E:\xampp-portable\htdocs\Festival\Admin\Reports\index.php on line 11
任何解决方案?