EDIT:
$query->where('`value` = ?', $number); It seems that does the job. I still don't know why it won't work under normal conditions, but it's a work around.. still looking for the right answer!
I'm trying to query a DB with a simple:
$number = 4;
$query = $this->select();
$query->where('value = ?', $number);
$row = $this->fetchRow($query);
But for some reason I constantly got 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 MySQL server version for the right syntax to use near 'value = 4) LIMIT 1' at line 1
When I do my assemble to see the query string:
SELECT `mighty_table`.* FROM `mighty_table` WHERE (value = 4)
My column name its not escaped..
Should Zend DB do that? :| It's strange since i use this same method in other projects and it always works..
Syntax error or access violationCheck you have your connection string correct. This could be caused by a wrong username/password.$query->where("value = '?', $number);. I can't see anything else that could be wrong.