JTable/load
From Joomla! Documentation
< API15:JTable
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
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 >