|
|
Home API Reference [REVIEW] database->setQuery |
| [REVIEW] database->setQuery |
|
|
|
|
Last reviewed: Not reviewed database->setQuerySets 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 (prior to Joomla 1.0)
void setQuery ( string $query [, string $prefix] )
Syntax (from Joomla 1.0 onwards)void setQuery ( sting $query [, integer $offset [, integer $limit [, string $prefix ]]] )
ExamplesExample: function getCategories() { global $database; $sql = 'SELECT * FROM #__categories'; $database->setQuery( $sql ); $rows = $database->loadObjectList(); foreach ( $rows as $row ) { echo "$row->title: $row->description\n"; } } getCategories(); might produce: Latest: The latest news from the Joomla Team Joomla: A selection of links that are all related to the Joomla project. Newsflash: Contacts: Contact Details for this web site Please report any errors on this page to the Developer Documentation Forum. |
|
| Last Updated ( Sunday, 24 December 2006 ) |
| < Prev | Next > |
|---|





