JDatabaseQuery/order: Difference between revisions
From Joomla! Documentation
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 20:39, 22 June 2012
Template:Description:JDatabaseQuery/order
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] Template: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');