我无法从前5行计算数据库中一列的总和。我的代码是:
$mysqli=mysqli_connect($host,$user,$password,$database);
$sql = "SELECT SUM(medie) FROM (SELECT medie FROM stelewar WHERE nume='".$nume."' ORDER BY id DESC LIMIT 5) medie";
$result=mysqli_query($mysqli,$sql);
$row=mysqli_fetch_assoc($result);
$sumamedie= $row["medie"];
最后一行代码抛出错误“Undefined index:medie”,我无法弄清楚为什么...... 有什么想法吗?