Actions

JTable/load

From Joomla! Documentation

Revision as of 16:53, 11 November 2008 by Batch1211 (Talk | contribs)

Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


Contents

Syntax

void load ($oid = NULL)

Parameters

Argument Data type Description Default
$oid integer Optional primary key. If not specifed, the value of current key is used. NULL

Returns

nothing

Description

JTable::load() - Loads a row from the database and binds the fields to the object properties.

Example

Let's say we have a table, that stores greetings of different languages:

id greeting language
1 Hello English
2 Bonjour French
3 Guten Tag German

If we'd like to load the record with the id #3, we can call the table object from within the model, and load the record:

$table = $this->getTable('greeting');
$table->load(3);
echo '<pre>';
print_r($table);
echo '</pre>';
 
/* RETURNS:
TableGreeting Object
(
    [id] => 3
    [greeting] => Guten Tag
    [language] => German
)
 
*/

See also