API16

JTable/getFields

From Joomla! Documentation

< API16:JTable
Revision as of 21:09, 24 March 2017 by JoomlaWikiBot (talk | contribs) (preparing for archive only)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Get the columns from database table.



Syntax[edit]

getFields()


Returns[edit]

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

Defined in[edit]

libraries/joomla/database/table.php

Importing[edit]

jimport( 'joomla.database.table' );

Source Body[edit]

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;
}



Examples[edit]

Code Examples[edit]