zend查询大于或等于

nhaq1z21  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(327)

我的查询在mysql中运行得非常好

SELECT * FROM accounts WHERE location_id=1 AND created_at>=*timestamp*

我有一个zend中accounts表的模型。我曾经

$accounts->where(array('location_id' => 1))

当我尝试使用另一个where子句时

->where("created_at >= $timestamp")

zend告诉我这个错误:

"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 7"

我也试着硬编码我的 $timestamp 变量,删除第一个 where 只使用第二个,甚至尝试将语法改为

->where("created_at >= " . $timestamp)

他们都没用。有什么想法吗?
以后编辑
我想出来了,好像是语法问题。这对我有用:

where("created_at >= '$timestamp'");
kninwzqo

kninwzqo1#

->where("start >= ?", $timestamp)

(在zf1中)。另外,在您所说的查询中,该列的名称是 created_at .

相关问题