Actions

API15

JTable/getNextOrder

From Joomla! Documentation

< API15:JTable
Revision as of 13:52, 12 May 2013 by JoomlaWikiBot (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

Returns the ordering value to place a new item last in its group

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

getNextOrder($where='')
Parameter Name Default Value Description
$where query WHERE clause for selecting MAX(ordering).

Defined in

libraries/joomla/database/table.php

Importing

jimport( 'joomla.database.table' );

Source Body

function getNextOrder ( $where='' )
{
        if (!in_array( 'ordering', array_keys($this->getProperties()) ))
        {
                $this->setError( get_class( $this ).' does not support ordering' );
                return false;
        }
 
        $query = 'SELECT MAX(ordering)' .
                        ' FROM ' . $this->_tbl .
                        ($where ? ' WHERE '.$where : '');
 
        $this->_db->setQuery( $query );
        $maxord = $this->_db->loadResult();
 
        if ($this->_db->getErrorNum())
        {
                $this->setError($this->_db->getErrorMsg());
                return false;
        }
        return $maxord + 1;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />