Difference between revisions of "JTable/load"

From Joomla! Documentation

(One intermediate revision by the same user not shown)
Line 70: Line 70:
===See also===
===See also===
* [[JTable/bind]]
* [[JTable/bind]]
* [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface#Creating the Table Class | Creating a JTable Child Class (MVC Tutorial Part 4)]]
* [[J3.2:Developing a MVC Component/Using the database#admin.2Ftables.2Fhelloworld.php | Part 7 of J3.2:Developing a MVC Component/Using the database]]
*[[J2.5:Developing a MVC Component/Adding configuration#admin.2Ftables.2Fhelloworld.php | Part 14 of J2.5:Developing a MVC Component/Adding configuration]]

Revision as of 19:52, 12 February 2014

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.


void load ($keys = NULL,$reset = true)


Argument Data type Description Default
$keys mixed An optional primary key value to load the row by, or an array of fields to match. NULL
$reset boolean True to reset the default values before loading the new row. NULL


True if successful. False if row not found or on error (internal error state set in that case).


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


JTable is an abstract class. You need to write a child class, to use its functionality. See Part 7 of Developing a MVC Component/Using the database


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');
echo '<pre>';
echo '</pre>';
TableGreeting Object
    [id] => 3
    [greeting] => Guten Tag
    [language] => German

See also