Actions

API15

JTable/load

From Joomla! Documentation

< API15:JTable
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Loads a row from the database and binds the fields to the object properties

[<! removed edit link to red link >]

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

Syntax

load($oid=null)
Parameter Name Default Value Description
$oid null Optional primary key. If not specifed, the value of current key is used

Returns

boolean True if successful

Defined in

libraries/joomla/database/table.php

Importing

jimport( 'joomla.database.table' );

Source Body

function load( $oid=null )
{
        $k = $this->_tbl_key;
 
        if ($oid !== null) {
                $this->$k = $oid;
        }
 
        $oid = $this->$k;
 
        if ($oid === null) {
                return false;
        }
        $this->reset();
 
        $db =& $this->getDBO();
 
        $query = 'SELECT *'
        . ' FROM '.$this->_tbl
        . ' WHERE '.$this->_tbl_key.' = '.$db->Quote($oid);
        $db->setQuery( $query );
 
        if ($result = $db->loadAssoc( )) {
                return $this->bind($result);
        }
        else
        {
                $this->setError( $db->getErrorMsg() );
                return false;
        }
}

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

Examples

<CodeExamplesForm />