Actions

API16

Difference between revisions of "JDatabaseQuery/order"

From Joomla! Documentation

< API16:JDatabaseQuery
(New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JDatabaseQuery/orde...)
 
(Examples: Added a small order example)
Line 46: Line 46:
 
===Examples===
 
===Examples===
 
<CodeExamplesForm />
 
<CodeExamplesForm />
 +
<source lang="php">
 +
$query->from('`#__categories` AS a');
 +
$query->where('a.extension = "com_weblinks" and a.published = "1"');
 +
$query->order('a.title ASC');
 +
</source>
 +
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n

Revision as of 14:39, 22 June 2012

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.

[Edit Descripton]

Description:JDatabaseQuery/order

Contents

Syntax

order($columns)
Parameter Name Default Value Description
$columns A string or array of ordering columns

Defined in

libraries/joomla/database/databasequery.php

Importing

jimport( 'joomla.database.databasequery' );

Source Body

public function order($columns)
{
        if (is_null($this->_order)) {
                $this->_order = new JDatabaseQueryElement('ORDER BY', $columns);
        } else {
                $this->_order->append($columns);
        }
 
        return $this;
}

[Edit See Also] SeeAlso:JDatabaseQuery/order

Examples

<CodeExamplesForm />

$query->from('`#__categories` AS a');           
$query->where('a.extension = "com_weblinks" and a.published = "1"');            
$query->order('a.title ASC');