views:

787

answers:

1

hi all, i want to output the query generated by Zend_Db_Table's select() statement for testing porposes but i dont know how.

+6  A: 

It's actually really easy. The select object implements a toString method.

$select = $table->select()->....
echo $select; //prints SQL

Or

$sql = $select->__toString();
David Caunt
or $sql = (string)$select;
smack0007