aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/OrderQueryComponent.php
blob: 04bb309c9e7f085139e668144256a08bb723b7a7 (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}";
	}
}