-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfavorite.php
More file actions
24 lines (21 loc) · 797 Bytes
/
favorite.php
File metadata and controls
24 lines (21 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include "dbConnection.php";
if(isset($_POST['deleteid']) && isset($_POST['userid'])){
$postid = $_POST['deleteid'];
$userid = $_POST['userid'];
$query = "DELETE FROM bookmarks WHERE user_id=$userid AND article_id = $postid;";
$delete = mysqli_query($connection, $query);
if(!$delete){
die("Error: " + mysqli_error($connection));
}
}
if(isset($_POST['insertid']) && isset($_POST['userid'])){
$postid = $_POST['insertid'];
$userid = $_POST['userid'];
$query = "INSERT INTO bookmarks(user_id, article_id) VALUES ($userid, $postid);";
$insert = mysqli_query($connection, $query);
if(!$insert){
die("Error: " + mysqli_error($connection));
}
}
?>