我有这个表,有一些数据,但我想得到的行,其中一个特定的列votecount
具有最大值:
<表类>
id
votecount
tbody><<tr>1 0 21 3 1 413 表类>
试试这个:
$selectr = "SELECT * from `audio` where `votecount` = ( SELECT MAX(`votecount`) from `audio`)";
$stmt = $conn->prepare($selectr);
$stmt->execute([]);
while($row = $stmt->fetch())
{
$userid = $row["id"];
$votecount = $row["votecount"];
echo $userid;
echo $votecount;
}
试更正:$userid = $row[">userid");to $userid = $row[">id"]