public function get_by_id($id)
 {
     //connect
     $this->db->connect();
     //query
     $sql = "SELECT * FROM products WHERE id=?";
     //prepare
     $stmt = $this->db->initialize($sql);
     //bind
     $stmt->bind_param("i", $id);
     //execute
     $stmt->execute();
     $stmt->bind_result($id, $product_name, $price, $image, $details);
     while ($row = $stmt->fetch()) {
         $product = new Product();
         $product->set_id($id);
         $product->set_product_name($product_name);
         $product->set_price($price);
         $product->set_image($image);
         $product->set_details($details);
     }
     return $product;
 }
 public function get_by_id($id)
 {
     $this->db->connect();
     $sql = "SELECT id,name,description,sell_price,cost_price,photo,status from tbl_products WHERE id=?";
     $stmt = $this->db->initStatement($sql);
     $stmt->bind_param("i", $id);
     $stmt->execute();
     $stmt->bind_result($id, $name, $description, $sell_price, $cost_price, $photo, $status);
     while ($stmt->fetch()) {
         $product = new Product();
         $product->set_id($id);
         $product->set_name($name);
         $product->set_description($description);
         $product->set_sell_price($sell_price);
         $product->set_cost_price($cost_price);
         $product->set_photo($photo);
         $product->set_status($status);
     }
     $this->db->close();
     return $product;
 }