aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/OrderQueryComponent.php
blob: 06549df3a73a90e8f19b7d36f0cd52ef5c6f0b74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/**
 * @class OrderQueryComponent
 * Order the query results.
 * @see Query
 */
class OrderQueryComponent extends QueryComponent
{
	function __construct($table, $field, $order = "asc")
	{
		global $CONFIG;

		$this->table = $CONFIG->dbprefix . sanitise_string($table);
		$this->field = sanitise_string($field);
		$this->order = sanitise_string($order);
	}

	function __toString()
	{
		return "order by {$this->table}.{$this->field} {$this->order}";
	}
}