-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatecar.php
81 lines (55 loc) · 1.23 KB
/
updatecar.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
73
74
75
76
77
78
79
80
81
<?php
function connect(){
$con =mysqli_connect('localhost','root','');
if(!$con)
{
echo 'Not connected';
}
else if(!mysqli_select_db($con,'rental _company'))
{
echo 'Databse not selected';
}
else{
return $con;
}
}
$v=$_POST['vid'];
$dr=$_POST['dr'];
$wr=$_POST['wr'];
if($wr==''){
updatedaily();
}
else if($dr==''){
updateweekly();
}
else{
upd();
}
function upd(){
$v=$_POST['vid'];
$dr=$_POST['dr'];
$wr=$_POST['wr'];
$c=connect();
$sql="UPDATE cars SET D_RATE=$dr, W_RATE=$wr WHERE TYPE='$v'";
$res=mysqli_query($c, $sql) or die("error on both");
header("refresh:2; url=index.php");
}
function updatedaily(){
$v=$_POST['vid'];
$dr=$_POST['dr'];
$wr=$_POST['wr'];
$c=connect();
$sql="UPDATE cars SET D_RATE=$dr WHERE TYPE='$v'";
$res=mysqli_query($c, $sql) or die("error on both");
header("refresh:2; url=index.php");
}
function updateweekly(){
$v=$_POST['vid'];
$dr=$_POST['dr'];
$wr=$_POST['wr'];
$c=connect();
$sql="UPDATE cars SET W_RATE=$wr WHERE TYPE='$v'";
$res=mysqli_query($c, $sql) or die("error on both");
header("refresh:2; url=index.php");
}
?>