我的查询在MySQL中运行得很好
SELECT * FROM accounts WHERE location_id=1 AND created_at>=*timestamp*我在Zend有一个账户表的模型。我用过
$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,甚至尝试将语法更改为
->where("created_at >= " . $timestamp)他们都不起作用。有音信吗?
稍后编辑
我想出来了,好像是语法问题。这对我起了作用:
where("created_at >= '$timestamp'");发布于 2018-04-17 21:43:06
->where("start >= ?", $timestamp)(用ZF1)。另外,在您说的查询中,该列名为created_at。
https://stackoverflow.com/questions/49881514
复制相似问题