The Typical PHP Approach
Typically a PHP programmer will write his SQL query as a string and will execute it via mysql_query.
$sql = "SELECT * FROM my_table"; $resource = mysql_query($sql); |
So eventually when you want to dump this “complex” query, or whatever query there is, you can simply “echo” it and see what’s its syntax.
// this query is WRONG because of the where clause $sql = "SELECT * FROM my_table WHERE id = "; // dump and debug the wrong query die($sql); // this line won't be executed $resource = mysql_query($sql); |
So far so good, but things appear to be a bit different when you start to work with Zend Framework. Higher levels of abstraction come with slightly more difficult ways to dump (debug) your SQL queries.
OK you’ve two options. Using Zend_Db_Select or … not.
Continue reading How to Dump the Generated Zend_Db SQL Query