| [REVIEW] database->loadAssocList |
|
Last reviewed: Not reviewed database->loadAssocListLoads an associative list of database rows. Syntaxarray loadAssocList ( string $key )
ExamplesExample: The function in this example echoes an associative array of fields from the Joomla categories table. function getCategories() { global $database; $sql = 'SELECT * FROM #__categories'; $database->setQuery( $sql ); $rows = $database->loadAssocList(); print_r( $rows ); } getCategories(); might produce: Array
(
[0] => Array
(
[id] => 1
[parent_id] => 0
[title] => Latest
[name] => Latest News
[image] => taking_notes.jpg
[section] => 1
[image_position] => left
[description] => The latest news from the Joomla Team
[published] => 1
[checked_out] => 0
[checked_out_time] => 2000-00-00 00:00:00
[editor] =>
[ordering] => 0
[access] => 0
[count] => 1
[params] =>
)
[1] => Array
(
[id] => 2
[parent_id] => 0
[title] => Joomla
[name] => Joomla
[image] => clock.jpg
[section] => com_weblinks
[image_position] => left
[description] => A selection of links that are all related to the Joomla project.
[published] => 1
[checked_out] => 0
[checked_out_time] => 0000-00-00 00:00:00
[editor] =>
[ordering] => 0
[access] => 0
[count] => 0
[params] =>
)
}
Please report any errors on this page to the Developer Documentation Forum. |
|
| Last Updated ( Monday, 25 December 2006 ) |