-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateTripName.php
More file actions
58 lines (49 loc) · 1.55 KB
/
Copy pathupdateTripName.php
File metadata and controls
58 lines (49 loc) · 1.55 KB
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
<?php session_start(); ?>
<?php
require_once 'config.php';
$id = $_SESSION["id"];
$name = $_REQUEST['tripname'];
$rating = $_REQUEST['rating'];
$cost = $_REQUEST['cost'];
if ($name != ''){
$sql = "UPDATE Trip
SET trip_name = '".$name."'
WHERE trip_id = '".$id."'";
if(mysqli_query($link, $sql)){
echo '<script>alert("Success, updating trip name")</script>';
}
else{
echo '<script>alert("Error, could not update your trip name")</script>';
}
}
if ($rating != ''){
$sql = "UPDATE Trip
SET rating = $rating
WHERE trip_id = '".$id."'";
if(mysqli_query($link, $sql)){
echo '<script>alert("Success, updating trip rating")</script>';
}
else{
echo '<script>alert("Error, could not update your trip rating")</script>';
}
}
if ($cost != ''){
$sql = "UPDATE Trip
SET cost = $cost
WHERE trip_id = '".$id."'";
if(mysqli_query($link, $sql)){
echo '<script>alert("Success, updating trip cost")</script>';
}
else{
echo '<script>alert("Error, could not update your trip cost")</script>';
}
}
//$sql = "UPDATE Trip
// SET cost = $cost, rating = $rating, trip_name = '".$name."'
// WHERE trip_id = '".$id."'";
//mysqli_query($link, $sql);
// echo "<script>location.href='ViewTrips.php'</script>";
$usrid = $_SESSION['usrid'];
$url = "ViewTrips.php?usrid=".$usrid;
echo '<script>location.href="'.$url.'"</script>';
?>