= $-6ren">
gpt4 book ai didi

php - MySQL返回错误记录

转载 作者:行者123 更新时间:2023-11-29 07:00:21 24 4
gpt4 key购买 nike

我在我的页面上运行查询,但它返回了错误的结果。这是我的代码:

$timestamp = time();
$query = "SELECT * FROM videos WHERE expire >= $timestamp AND home = 1 AND active = 1 ORDER BY id DESC LIMIT 1";
$result = mysql_query($query) or die(mysql_error());

if(mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
foreach ($row as $key => $value) {
$$key = $value;
}
}

问题是,它返回的是第二条记录,而不是最近的 ID。但是,奇怪的是,如果我在 MySQL 的查询窗口中运行它,它会返回正确的记录。

这是它应该返回的记录数据:id: 53, videoid: abc123, expire:1335596400, home: 1, active:1

有人对此有任何想法吗?

最佳答案

13355964004 月 28 日,因此 cleary 不是 time() 的结果;看来您正在使用 MySQL 中的另一个时间戳(或根本没有时间戳)运行查询

关于php - MySQL返回错误记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10522288/

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