gpt4 book ai didi

php - 获取最新记录提交SQL的时间

转载 作者:行者123 更新时间:2023-11-29 12:08:21 25 4
gpt4 key购买 nike

我想获取特定用户最新记录的时间。

假设用户创建了 4 行,其中包含其独特的 ID(称为 steamid)。它们都是在不同时间制作的。我想知道最新一期的制作时间。

The table

因此选择我尝试过的底部记录。

$time = "SELECT max(time) FROM bets WHERE steamid='$number'";
$result = mysqli_query($conn,$time);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$previous = $row["time"];
}
} else {
$previous = '0';
}

但是 $previous 的转储会返回 null。

最佳答案

结果中不会有名为 time 的列,因为您没有为 max(time) 的结果指定任何别名

将查询更改为:SELECT max(time) as time ...

关于php - 获取最新记录提交SQL的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31103922/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com