Possible Duplicate:
How do I add a limit to update-query in Zend Framework?
I would like to do a update and place LIMIT 1 as precaution.
Here is my code:
$vals = array();
$vals['status'] = 'closed';
$where = $write->quoteInto('id =?', $orderID);
$write->update("order", $vals ,$where);
Where can i add a LIMIT into this query?
(looks like has been asked in the past but i hope someone out there has the answer)
It looks like you’re using Zend_Db_Adapter to perform your queries so I’m not sure you can do what I do, anyway here goes.
I usually use the Zend_Db_Table_Row save() method to insert and update records, however I also use the DbTable models to provide access to the Table and Table_Row abstract api’s.
what this amounts to is that if I include and ID in the data array (or in this case an entity object) the row will be updated and if there is no ID in the object a new row will be created.
If your curious here’s how I __construct the class:
Hope this provides some help.