Actions

API16

JTable/getFields

From Joomla! Documentation

< API16:JTable
Revision as of 17:41, 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

Get the columns from database table.

[Edit Descripton]

Description:JTable/getFields

Syntax

getFields()


Returns

mixed An array of the field names, or false if an error occurs.

Defined in

libraries/joomla/database/table.php

Importing

jimport( 'joomla.database.table' );

Source Body

public function getFields()
{
        static $cache = null;
 
        if ($cache === null)
        {
                // Lookup the fields for this table only once.
                $name   = $this->getTableName();
                $fields = $this->_db->getTableFields($name, false);
 
                if (!isset($fields[$name])) {
                        $this->setError(JText::_('JTable_Error_Columns_not_found'));
                        return false;
                }
                $cache = $fields[$name];
        }
 
        return $cache;
}

[Edit See Also] SeeAlso:JTable/getFields

Examples

<CodeExamplesForm />