I have the following piece of code which i taken from model,
...
$select = $this->_db->select()
->from($this->_name)
->where('shipping=?',$type)
->where('customer_id=?',$userid);
echo $select; exit; // which gives exact mysql query.
.....
When i use update query in zend like ,
$up_value = array('billing'=> '0');
$this->update($up_value,'customer_id ='.$userid.' and address_id <> '.$data['address_Id']);
Here i want to know the exact mysql query. Is there any possible way to print the mysql query in zend ? kindly advice
Select objects have a __toString() method in Zend Framework.
From the Zend Framework manual:
An alternative solution would be to use the Zend_Db_Profiler. i.e.
http://framework.zend.com/manual/en/zend.db.select.html
I have traversed hundred of pages, googled a lot but i have not found any exact solution. Finally this worked for me. Irrespective where you are in either controller or model. This code worked for me every where. Just use this
Finally this thing worked for me.
Example:
This one's from Zend Framework documentation (ie. UPDATE):
(Bonus) I use this one in my own model files:
Have a nice day :)
from >= 2.1.4
I have done this by this way