PHP MySQLi 预处理语句 select 在特定时间添加到记录的行

PHP MySQLi prepared statements select rows that are added to records in specific time

我遇到了类似的错误:PHP mysqli condition greater than or less than symbol error

但是我没有找到解决这个问题的方法,因为我的应用程序有点不同。

我现在有以下声明:

$stmt = $this->mysqli->prepare("SELECT * FROM applications");
$stmt->bind_param("i", $MTNOW);

每次我的用户发送新的应用程序时,都会有一个名为 "mtime" 的字段代表 "microtime",它四舍五入为没有双精度值的数字格式,因此它是 1489344810。

如何对准备好的语句进行计算,这样它会 select 每行的微时间并将其增加 18000 秒(5 小时),以便我可以将结果与当前微时间进行比较?它应该只显示在 5 小时内创建的结果。其余记录将不会显示。

想法:

SELECT * FROM applications WHERE (mtime+18000) < ?
bind_param("i", $MTNOW);

查看文档:

http://php.net/manual/en/pdostatement.bindparam.php

$stmt = $this->mysqli->prepare("SELECT * FROM applications WHERE mtime < ?");
$stmt->bind_param("1", (yourValue + or - 18000));
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_OBJ);