Example #1
0
 public function edit(Product $product)
 {
     $query = "Update products Set name = ?, categoryId = ?, price = ?, quantity = ?, editorId = ?\n        WHERE products.id = ?";
     $params = [$product->getName(), $product->getCategoryId(), $product->getPrice(), $product->getQuantity(), $product->getEditorId(), $product->getId()];
     $this->db->query($query, $params);
     $result = $this->db->row();
     return $result;
 }
 public function updateProduct(Product $product)
 {
     $result = $this->db->prepare("\n\t\t\tUPDATE product\n\t\t\tSET name = ?,\n\t\t\t\tquantity = ?,\n\t\t\t\tdescription = ?,\n\t\t\t\tcategory_id = ?\n\t\t\tWHERE id = ?\n\t\t");
     $result->execute([$product->getName(), $product->getQuantity(), $product->getDescription(), $product->getCategoryId(), $product->getId()]);
 }