functions_post_oo.php
static function get($post_id)
	{
		global $db;
		//$sql = "SELECT p.*, t.topic_first_post_id, t.topic_last_post_id
		//		FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
		//		WHERE p.post_id=" . intval($this->post_id) . " AND t.topic_id = p.topic_id";
		$sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id=" . intval($post_id);
		$result = $db->sql_query($sql);
		$post_data = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if(!$post_data)
		{
			//post does not exist, return false
			return false;
		}


		return post::from_array($post_data);
	}
static function get($post_id)
	{
		global $db;
		//$sql = "SELECT p.*, t.topic_first_post_id, t.topic_last_post_id
		//		FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
		//		WHERE p.post_id=" . intval($this->post_id) . " AND t.topic_id = p.topic_id";
		$sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id=" . intval($post_id);
		$result = $db->sql_query($sql);
		$post_data = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if(!$post_data)
		{
			//post does not exist, return false
			return false;
		}


		return post::from_array($post_data);
	}
static function get ( $ post_id ) { global $ db ; //$sql = "SELECT p.*, t.topic_first_post_id, t.topic_last_post_id //		FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t //		WHERE p.post_id=" . intval($this->post_id) . " AND t.topic_id = p.topic_id"; $ sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id=" . intval ( $ post_id ) ; $ result = $ db -> sql_query ( $ sql ) ; $ post_data = $ db -> sql_fetchrow ( $ result ) ; $ db -> sql_freeresult ( $ result ) ; if ( ! $ post_data ) { //post does not exist, return false return false ; } return post :: from_array ( $ post_data ) ; }
static method, loads the post with a given post_id from database.
returns false if the post does not exist
static method loads the post with a given post_id from database . returns false if the post does not exist