1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 14 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Developer Manual arrow 11. API Reference arrow [WORKING] mosDBTable->bind

[WORKING] mosDBTable->bind PDF Print E-mail

Last reviewed: Not reviewed


Copy the contents of an array into the database table object.  This function may be overloaded/supplemented by the child class as required.

The table object is not saved; use mosDBTable->store for that.  This function matches fields in the array with attributes of the same name in the table object. If a field exists in the array but does not match an attribute in the table object then it is ignored. If an attribute exists in the table object but does not match an array field then it will be ignored. Table object attributes with names beginning with an underscore character are always ignored.

Returns true if successful; false otherwise.  If false then the error message can be retrieved using the mosDBTable->getError function.


boolean bind ( array $array [, string $ignore ] )

is the array whose contents are to be bound to the database table object.
is a prefix string. An array entry will bind to a table object attribute only if the field name with the prefix string prepended to it also exists. This parameter is optional and if omitted will default to an empty string.


Example: This example uses the myTable class defined on the mosDBTable class overview page.

global $database;
// Declare an instance of the myTable class.
$row = new myTable( $database );
// Load record with primary key $id.
$row->load( $id );
// Update the title field in the database object.
if (!$row->bind( $_POST, 'title' )) {
  mosErrorAlert( $row->getError() );
// Save the updated record back to the database.
if (!$row->store()) {
  mosErrorAlert( $row->getError() );

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )
< Prev   Next >