1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 3 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Developer Manual arrow 11. API Reference arrow [REVIEW] database->loadObjectList

[REVIEW] database->loadObjectList PDF Print E-mail

Last reviewed: Not reviewed


Returns an array of database objects using the current SQL query.  Returns false if the query fails (prior to Joomla 1.1 returned null).


array loadObjectList ( [ string $key ] )

is the field name of a primary key. If $key is empty or null then loadObjectList will return a sequential list of the records returned by the database query. If $key is not empty or null then the array returned will be indexed by the value of the database key. This parameter is optional and if omitted will default to null (empty prior to Joomla 1.1).



function getCategories() {
  global $database;
  $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: A selection of links that are all related to the Joomla project.
Contacts: Contact Details for this web site

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )
< Prev   Next >