-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.php
32 lines (32 loc) · 1001 Bytes
/
create.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
<?php
define('USER','root');
define('PASS','');
define('DB','lids');
$requestJSONData = file_get_contents('php://input');
$requestArray = json_decode($requestJSONData,true);
print_r($requestArray);
$con = mysqli_connect('localhost',USER,PASS,DB);
$vehicleid = $requestArray["vehicleid"];
$uuid = $requestArray["uuid"];
echo "uuid: " .$uuid;
$triplocation = $requestArray["triplocation"];
$triplocation=json_encode($triplocation);
echo "triplocation:".$triplocation;
$sql = "select COUNT(*) from tb_usertrips where uuid in('".$uuid."');";
$res = mysqli_query($con,$sql);
$tripid=$res+1;
echo "tripid:".$tripid;
//$sql = "INSERT INTO tb_usertrips VALUES('106',221,0,2,'sanfbasjf',true);";
$sql = "INSERT INTO tb_usertrips VALUES('".$uuid."','".$tripid."',0,'".$vehicleid."','".$triplocation."',true);";
print $sql;
$result=mysqli_query($con,$sql);
if($result===TRUE)
print "db insert success";
else
{
// print mysqli_error($con);
print "db insert fail";
}
mysqli_close($con);
// echo $tripid;
?>