API15

JDatabaseMySQLi/loadObjectList: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 56: Line 56:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=loadObjectList
  category=loadObjectList
  category=JDatabaseMySQLi
  category=JDatabaseMySQLi
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:28, 25 March 2017

Description

Load a list of database objects

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

loadObjectList($key='')
Parameter Name Default Value Description
$key The field name of a primary key

Returns

array If is empty as sequential list of returned records.

Defined in

libraries/joomla/database/database/mysqli.php

Importing

jimport( 'joomla.database.database.mysqli' );

Source Body

function loadObjectList( $key='' )
{
        if (!($cur = $this->query())) {
                return null;
        }
        $array = array();
        while ($row = mysqli_fetch_object( $cur )) {
                if ($key) {
                        $array[$row->$key] = $row;
                } else {
                        $array[] = $row;
                }
        }
        mysqli_free_result( $cur );
        return $array;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples