references:joomla.framework:database:jdatabase-loadassoclistTable of Contents
loadAssocList
Loads an associative list of database rows. If the $key parameter is set, the specified field will be used as the index for the array. Otherwise, sequential numbering will be used for the array. Syntaxarray loadAssocList ( $key )
ExamplesExample $dbo =& JFactory::getDBO(); $query = "SELECT bid, name, clickurl FROM #__banner"; $dbo->setQuery( $query ); $row =& $dbo->loadAssocList( 'bid' ); print_r( $row ); might produce: Result Array ( [1] => Array ( [bid] => 1 [name] => OSM 1 [clickurl] => http://www.opensourcematters.org ) [2] => Array ( [bid] => 2 [name] => OSM 2 [clickurl] => http://www.opensourcematters.org ) [3] => Array ( [bid] => 3 [name] => Joomla! [clickurl] => http://www.joomla.org ) [4] => Array ( [bid] => 4 [name] => Joomla! Forge [clickurl] => http://forge.joomla.org ) [5] => Array ( [bid] => 5 [name] => Joomla! Extensions [clickurl] => http://extensions.joomla.org ) ) Discussion |


