From abb259bbd12e69b88908533089e88da9d5a782f4 Mon Sep 17 00:00:00 2001 From: SIMAILA Djalim Date: Sat, 21 Jan 2023 18:16:45 +0100 Subject: [PATCH] appreciation model --- Models/AppreciationModel.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Models/AppreciationModel.php diff --git a/Models/AppreciationModel.php b/Models/AppreciationModel.php new file mode 100644 index 0000000..bfa73cb --- /dev/null +++ b/Models/AppreciationModel.php @@ -0,0 +1,32 @@ +prepare("SELECT * FROM APPPRECIATION WHERE ID = :recipe_id"); + $stmt->bindParam("recipe_id",$I_recipe_id); + $stmt->execute(); + return $stmt->fetch(); + } + public function createAppreciation($I_recipe_id,$I_user_id,$S_Comment,$I_score){ + $O_model = Model::get(); + $stmt = $O_model->prepare("INSERT INTO APPPRECIATION(COMMENT,SCORE,DATE,AUTHOR_ID,RECIPE_ID) VALUES(:comment,:score,:date,:author_id,:recipe_id)"); + $stmt->bindParam("comment",$S_Comment); + $stmt->bindParam("score",$I_score); + $_date = date("Y-m-d"); + $stmt->bindParam("date",$_date); + $stmt->bindParam("author_id",$I_user_id); + $stmt->bindParam("recipe_id",$I_recipe_id); + $stmt->execute(); + return $stmt->fetch(); + } + public function deleteAppreciation($I_recipe_id){ + $O_model = Model::get(); + $stmt = $O_model->prepare("DELETE FROM APPPRECIATION WHERE ID = :recipe_id"); + $stmt->bindParam("recipe_id",$I_recipe_id); + $stmt->execute(); + } + public function updateAppreciation($I_recipe_id){ + + } +}