Zend 查询大于或等于
Zend query greater than or equal to
我的查询在 MySQL
中完美运行
SELECT * FROM accounts WHERE location_id=1 AND created_at>=*timestamp*
我在 Zend 中有一个帐户模型 table。我用了
$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)
None 他们成功了。有什么想法吗?
稍后编辑
我弄明白了,看来是语法问题。这对我有用:
where("created_at >= '$timestamp'");
->where("start >= ?", $timestamp)
(在 ZF1 中)。此外,在您所说的查询中,列名为 created_at
.
我的查询在 MySQL
中完美运行SELECT * FROM accounts WHERE location_id=1 AND created_at>=*timestamp*
我在 Zend 中有一个帐户模型 table。我用了
$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)
None 他们成功了。有什么想法吗?
稍后编辑
我弄明白了,看来是语法问题。这对我有用:
where("created_at >= '$timestamp'");
->where("start >= ?", $timestamp)
(在 ZF1 中)。此外,在您所说的查询中,列名为 created_at
.