-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
443 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
function getAllFavourites($db, $userID) { | ||
$stmt = $db->prepare( | ||
'SELECT Restaurant.restaurantID, name | ||
FROM Favourite JOIN Restaurant ON Favourite.restaurantID = Restaurant.restaurantID | ||
WHERE userID = :userID | ||
ORDER BY name' | ||
); | ||
$stmt->bindParam(':userID', $userID); | ||
$stmt->execute(); | ||
$favourites = $stmt->fetchAll(); | ||
return $favourites; | ||
} | ||
|
||
function checkIfFavourite($db, $userID, $restaurantID) { | ||
$stmt = $db->prepare( | ||
'SELECT * FROM Favourite | ||
WHERE userID = :userID | ||
AND restaurantID = :restaurantID' | ||
); | ||
$stmt->bindParam(':userID', $userID); | ||
$stmt->bindParam(':restaurantID', $restaurantID); | ||
$stmt->execute(); | ||
$favourites = $stmt->fetchAll(); | ||
|
||
if (sizeof($favourites) === 0) | ||
return false; | ||
return true; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
function addCommentToDatabase($db, $comment, $date, $custommerID, $restaurantID) { | ||
$stmt = $db->prepare( | ||
'INSERT INTO Review (comment, date, customerID, restaurantID) VALUES ( | ||
:comment, | ||
:date, | ||
:customerID, | ||
:restaurantID | ||
)' | ||
); | ||
$stmt->bindParam(':comment', $comment); | ||
$stmt->bindParam(':date', $date); | ||
$stmt->bindParam(':customerID', $custommerID); | ||
$stmt->bindParam(':restaurantID', $restaurantID); | ||
|
||
$stmt->execute(); | ||
} | ||
|
||
function addResponseToDatabase($db, $comment, $date, $reviewID, $ownerID) { | ||
$stmt = $db->prepare( | ||
'INSERT INTO ReviewResponse (comment, date, reviewID, ownerID) VALUES ( | ||
:comment, | ||
:date, | ||
:reviewID, | ||
:ownerID | ||
)' | ||
); | ||
$stmt->bindParam(':comment', $comment); | ||
$stmt->bindParam(':date', $date); | ||
$stmt->bindParam(':reviewID', $reviewID); | ||
$stmt->bindParam(':ownerID', $ownerID); | ||
|
||
$stmt->execute(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
function addToFavourties($db, $userID, $restaurantID) { | ||
$stmt = $db->prepare( | ||
'INSERT INTO Favourite VALUES( | ||
:userID, | ||
:restaurantID | ||
)' | ||
); | ||
$stmt->bindParam(':userID', $userID); | ||
$stmt->bindParam(':restaurantID', $restaurantID); | ||
$stmt->execute(); | ||
} | ||
|
||
function removeFromFavourites($db, $userID, $restaurantID) { | ||
$stmt = $db->prepare( | ||
'DELETE FROM Favourite | ||
WHERE userID = :userID | ||
AND restaurantID = :restaurantID' | ||
); | ||
$stmt->bindParam(':userID', $userID); | ||
$stmt->bindParam(':restaurantID', $restaurantID); | ||
$stmt->execute(); | ||
} | ||
?> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.