aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/OrderQueryComponent.php
blob: acaad036f6d2f979399e5f213ee64129b88a526d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/**
 * @class OrderQueryComponent
 * Order the query results.
 * @author Curverider Ltd
 * @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}";
	}
}