forked from sarahdoi/Oun-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrate.php
72 lines (54 loc) · 1.44 KB
/
rate.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
include 'connection.php';
//include 'functions.php';
session_start();
//if( ! $con = mysqli_connect(DBHOST , DBUSER , DBPWD , DBNAME)){ die("failed to connect!");}
//$booking_id =1;
if (isset($_GET['booking_id'])) {
$bookingid = $_GET['booking_id'];
}else{
$bookingid=1;
}
if (!isset($_POST['rate']))
$rate = 0;
else {
if($_POST['rate'] == 5) {
$rate =5;
}if($_POST['rate'] == 4) {
$rate =4;
} else if($_POST['rate'] == 3) {
$rate = 3;
} else if($_POST['rate'] == 2) {
$rate = 2;
} else if($_POST['rate'] == 1) {
$rate = 1;
}
}
if (isset($_POST['review']))
$review = $_POST['review'];
$query = "UPDATE `bookings` SET `review`='$review',`rating`='$rate' WHERE booking_id='$bookingid'"; //works if its 1
$result = mysqli_query($con,$query );
if ( !$result)
header("location: mprofile.php? failed to query");
header("location: mprofile.php?");
exit();
//}
//if (mysqli_num_rows($result) > 0) {
//echo $_GET['booking_id'];
mysqli_close($con);
/*switch $answer {
case "add":
//Check if guess is right and echo
break;
case "substract":
//Check if guess is right and echo
break;
case "multiply":
//Check if guess is right and echo
break;
case "divide":
//Check if guess is right and echo
break;
};
*/
?>