I don't know it might be me doing something wrong here, bat can you please
point me to the correct way of doing this:
I try to construct a simple SQl statement with Zend_Db_Select like this
$select = $db->select();
$select->from('table_name');
$select->where("$field = ?", $value);
It produces a query like this:
SELECT `table_name`.* FROM `table_name` WHERE (field = 'yes')
That gets returns an SQL error because field name in WHERE statement is not
quoted. Correctly it should be like this:
SELECT `table_name`.* FROM `table_name` WHERE (`field` = 'yes')
Of course i can add quotes manually but my question is - is this correct
behavior? Because all the examples in the documentation don't have quotes in
WHERE statements.
--
View this message in context: http://www.nabble.com/Simple-Db_Select-WHERE-statement-returns-an-error.-tp23693525p23693525.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论