====== setQuery ====== {#JAPI Joomla.Framework Database JDatabase::setQuery #} Sets the SQL query string for later execution. This function also replaces all occurrences within the query string of a given string identifier with the current database table prefix code. Note that this function does not cause the SQL query to be executed. ===== Syntax ===== void setQuery ( **$sql**, **$offset**, **$limit**, **$prefix** ) | **$sql** | string | is a string containing the SQL query. | | **$offset** | integer | is an integer containing the table row offset for use with page navigation code. This parameter is optional and if omitted will default to null. | | **$limit** | integer | is an integer containing the maximum number of rows to be returned by the SQL query. This parameter is optional and if omitted will default to null. | | **$prefix** | string | is a string containing the identifier to be replaced by the current database table prefix code. This parameter is optional and if omitted will default to '#__'. | ===== Examples ===== $database =& JFactory::getDBO(); $sql = 'SELECT * FROM #__categories'; $database->setQuery( $sql ); $rows = $database->loadObjectList(); foreach ( $rows as $row ) { echo "$row->title: $row->description\n"; } might produce: Latest: The latest news from the Joomla! Team Joomla! Specific Links: A selection of links that are all related to the Joomla! Project. Newsflash: Joomla!: Business: general: Existing Users: Here you will find an example set of FAQs. Linux: Internet: Contacts: Contact Details for this website Joomla: Text Ads: Features: Benefits: Platforms: Other Resources: test555: The CMS: Information about the software behind Joomla!
Current Users: Questions that users migrating to Joomla! 1.5 are likely to raise
The Project: General facts about Joomla!
New to Joomla: Questions for new users of Joomla!
The Community: About the millions of Joomla! users and websites
General: General questions about the Joomla! CMS Languages: Questions related to localisation and languages
---- ~~DISCUSSION~~