Actions

API15

JTable/store

From Joomla! Documentation

< API15:JTable
Revision as of 17:16, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Inserts a new row if id is zero or updates an existing row in the database table

[Edit Descripton]

Description:JTable/store

Syntax

store($updateNulls=false)
Parameter Name Default Value Description
$updateNulls false If false, null object variables are not updated

Returns

null|string null if successful otherwise returns and error message

Defined in

libraries/joomla/database/table.php

Importing

jimport( 'joomla.database.table' );

Source Body

function store( $updateNulls=false )
{
        $k = $this->_tbl_key;
 
        if( $this->$k)
        {
                $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
        }
        else
        {
                $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key );
        }
        if( !$ret )
        {
                $this->setError(get_class( $this ).'::store failed - '.$this->_db->getErrorMsg());
                return false;
        }
        else
        {
                return true;
        }
}

[Edit See Also] SeeAlso:JTable/store

Examples

<CodeExamplesForm />