<?PHP
class forum_SQL extends SqlRequest{

	var $table = 'forum';

	function forum($add_sql = '', $execute = false, $cache = false){

		$this->LINE = __FILE__.' '.__LINE__;
		return $this->Select(
			"SELECT *, DATE_FORMAT(created_at, '%d.%m.%Y') as created_at_str, DATE_FORMAT(updated_at, '%d.%m.%Y') as updated_at_str FROM forum  ".
		$add_sql,
		$execute,
		$cache
		);
	}

	function forum_join_users($add_sql = '', $execute = false, $cache = false){

		$this->LINE = __FILE__.' '.__LINE__;
		return $this->Select(
			"SELECT p1.*, DATE_FORMAT(p1.created_at, '%d.%m.%Y') as created_at_str, DATE_FORMAT(p1.updated_at, '%d.%m.%Y') as updated_at_str, p2.name as user_name FROM forum AS p1 ".
			"JOIN users AS p2 ON p2.id = p1.created_by ".
		$add_sql,
		$execute,
		$cache
		);
	}
}
?>