7

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

2 Answers 2

15

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

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

Or

$sql = $select->__toString();
Sign up to request clarification or add additional context in comments.

Comments

2

or cast it to string and then use it:

(string)$table->select();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.