-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddWishlist.php
48 lines (39 loc) · 1.01 KB
/
AddWishlist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
//Tell PHP to log errors
ini_set('log_errors', 'On');
//Tell PHP to not display errors
ini_set('display_errors', 'Off');
//Set error_reporting to E_ALL
ini_set('error_reporting', E_ALL );
include '_dbConnect.php';
// Start the session
session_start();
if(!$_SESSION['uname'])
{
$_SESSION['AddWishlistAlert'] = true;
header("Location:index.php");
}
else
{
$uname = $_SESSION['uname'];
$uid = $_SESSION['uid'];
$pid = $_GET["pid"];
$sql = "select * from wishlist where uid='$uid' and pid='$pid'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);
$_SESSION['wishlistAdded'] = false;
$_SESSION['AlreadyWishlist'] = false;
if(!$row)
{
$sql = "INSERT INTO `wishlist` ( `uid`, `uname`, `pid`, `date`) VALUES ('$uid', '$uname', '$pid', current_timestamp())";
$resultt = mysqli_query($conn,$sql);
$_SESSION['wishlistAdded'] = true;
header("Location:ViewWishlist.php?uid=$uid");
}
else
{
$_SESSION['AlreadyWishlist'] = true;
header("Location:ViewWishlist.php?uid=$uid");
}
}
?>