Reputation: 161
I have my query which works perfectly in MySQL
SELECT * FROM accounts WHERE location_id=1 AND created_at>=*timestamp*
I have a model for the Accounts table in Zend. I used
$accounts->where(array('location_id' => 1))
and when I try to use another where clause
->where("created_at >= $timestamp")
Zend throws me this error:
"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"
I have also tried to hardcode my $timestamp
variable, delete the first where
and use just the second one, and even tryed to change the syntax to
->where("created_at >= " . $timestamp)
None of them worked. Any ideeas?
LATER EDIT
I figured it out, it seems it was a syntax problem. This worked for me:
where("created_at >= '$timestamp'");
Upvotes: 1
Views: 948
Reputation: 33148
->where("start >= ?", $timestamp)
(in ZF1). Also, in the query you said works perfectly the column is named created_at
.
Upvotes: 2