<?phppublic class NewsPost{ public $dbLink; public $postID; public function __construct($id, $link) { $this->postID = $id; $this->dbLink = $link; } public function get() { } public function insert($data) { } public function update($data) { } public function delete() { } public static function search($condition, $sort, $order) { //Since this is static, you don't have to instantiate a NewsPost object to call this function. if($sort == null) { $sort = "newsposts.postId"; } if($order == null) { $order = "ASC" } $sql = "SELECT newsposts.postID FROM newsposts INNER JOIN _ ON _ = _ WHERE $condition $sort $order"; if(!$result = msyql_query($sql)) { //Debug sql statement if it fails die($sql); } $resultSet = array(); while($r = mysql_fetch_assoc($result)) { foreach($r as $key => $val) { //Assuming that all data in the tables are sanitized \'s -- Strip the slashes. $r[$key] = stripslashes($val); } array_push($resultSet, $r); } //Returns the associative array (data set) based on conditions and sort/order. return $resultSet; }}?>