Login / Status
developer.Resource

Sponsors

<<: back to overview

okGet SQL-Query from exec_SELECTquery

userpicfrom Martin Holtz posted at 2008-08-11, Language: php

Submitting your vote...
Rating: 4.8 of 5. 4 vote(s).
Click the rating bar to rate this item.

Tags: mysql, sql, TYPO3_DB, globals, store_lastBuildQuery, debug_lastBuildQuery, exec_SELECTquery, debug

There is a build in function which stores the last SQL-Statement which is created via $GLOBALS['TYPO3_DB']->exec_*query
  1.  
  2. $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = 1;
  3.  
  4. // process query
  5. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit);
  6.  
  7. // the complete SQL-Statement
  8. echo $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;

here is the code in plain for copy&paste