// __construct() function ProductOrder($id) { global $db; $this->db = $db; // database handler $this->id = $id; // get order data $query = sprintf( "SELECT id, user_id, product_id, quantity, specialOrder, dateModified FROM product_order WHERE id = %d", $this->id ); $result = $this->db->get_row($query); $this->userId = $result->user_id; $this->productId = $result->product_id; $this->quantity = $result->quantity; $this->dateModified = $result->dateModified; } /** * these functions return characteristics of the order * @access PUBLIC */ function getProductName() { $product = new Product($this->productId); return $product->getName(); } function getUserFullName() { $user = new User($this->userId); return $user->getFullName(); }