API15

JTable/getNextOrder

From Joomla! Documentation

< API15:JTable

The "API15" 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]

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[edit]

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

Defined in[edit]

libraries/joomla/database/table.php

Importing[edit]

jimport( 'joomla.database.table' );

Source Body[edit]

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[edit]

Code Examples[edit]