How to print exact sql query in zend framework ?

Answer

Select objects have a __toString() method in Zend Framework.

From the Zend Framework manual:

$select = $db->select()->from('products');

$sql = $select->__toString();
echo "$sql\n";// The output is the string://   SELECT * FROM "products"

An alternative solution would be to use the Zend_Db_Profiler. i.e.

$db->getProfiler()->setEnabled(true);// your code
$this->update($up_value,'customer_id ='.$userid.' and address_id <> '.$data['address_Id']);Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);

All zend-framework Questions

Ask your interview questions on zend-framework

Write Your comment or Questions if you want the answers on zend-framework from zend-framework Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---