| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Database |
JDatabase |
loadAssoc |
loadAssoc() |
Never | Work in Progress |
Executes the current query and returns the first result row in an associative array.
void loadAssoc ()
Example
$dbo =& JFactory::getDBO(); $query = "SELECT name, clickurl FROM #__banner"; $dbo->setQuery( $query ); $row = $dbo->loadAssoc(); print_r( $row ); echo "<br />"; $row = $dbo->loadAssoc(); print_r( $row );
might produce:
Result
Array ( [name] => OSM 1 [clickurl] => http://www.opensourcematters.org ) Array ( [name] => OSM 1 [clickurl] => http://www.opensourcematters.org )
Note that this method can only be used to obtain the first result (as illustrated above).