JDatabase::loadObjectList: Difference between revisions
From Joomla! Documentation
Updated to r1448:247ba8d88526 |
addes small example |
||
| Line 44: | Line 44: | ||
</span> | </span> | ||
===User contributed notes=== | ===User contributed notes=== | ||
===Examples=== | |||
<source lang="php"> | |||
// Create a new query object. | |||
$db = &JFactory::getDBO(); | |||
$query = $db->getQuery(true); | |||
$query->select('cats.description AS description, cats.title AS titel'); | |||
$query->from('#__categories AS cats'); | |||
$query->where('cats.id="1"'); | |||
$db->setQuery($query); | |||
$Category = $db->loadObjectList(); | |||
</source> | |||
<CodeExamplesForm /> | <CodeExamplesForm /> | ||
<dpl> | <dpl> | ||
Revision as of 21:33, 26 June 2012
JDatabase::loadObjectList
Description
Method to get an array of the result set rows from the database query where each row is an object.
Template:Description:JDatabase::loadObjectList [Edit Descripton]
public function loadObjectList (
$key=''
$class= 'stdClass'
)
| Parameter | Type | Default | Description |
|---|---|---|---|
| $key | |||
| $class | 'stdClass' |
- Returns
- Defined on line 707 of libraries/joomla/database/database.php
See also
JDatabase::loadObjectList source code on BitBucket
Class JDatabase
Subpackage Database- Other versions of JDatabase::loadObjectList
Template:SeeAlso:JDatabase::loadObjectList [Edit See Also]
User contributed notes
Examples
// Create a new query object.
$db = &JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('cats.description AS description, cats.title AS titel');
$query->from('#__categories AS cats');
$query->where('cats.id="1"');
$db->setQuery($query);
$Category = $db->loadObjectList();
<CodeExamplesForm />