-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnection.php
More file actions
52 lines (43 loc) · 1.52 KB
/
Copy pathconnection.php
File metadata and controls
52 lines (43 loc) · 1.52 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
<?php
$host="localhost";
$user="root";
$pass="";
$db="train-tasks";
$connection=@mysqli_connect($host, $user, $pass ,$db);
if(isset($_POST['Save'])){
$motor1=$_POST['motor1'];
$motor2=$_POST['motor2'];
$motor3=$_POST['motor3'];
$motor4=$_POST['motor4'];
$motor5=$_POST['motor5'];
$motor6=$_POST['motor6'];
$sql_query_insert="INSERT INTO motors (motor1, motor2, motor3, motor4, motor5, motor6, status)
VALUES (10,10,10,10,10,10,false)";
mysqli_query($connection, $sql_query_insert);
} else if(isset($_POST['Run'])){
$sql_query_insert="INSERT INTO motors (motor1, motor2, motor3, motor4, motor5, motor6, status)
VALUES (10,10,10,10,10,10,true)";
mysqli_query($connection, $sql_query_insert);
}elseif(isset($_POST['left'])){
$sql_query_insert="INSERT INTO direction (direction)
VALUES ('left')";
mysqli_query($connection, $sql_query_insert);
}elseif(isset($_POST['right'])){
$sql_query_insert="INSERT INTO direction (direction)
VALUES ('right')";
mysqli_query($connection, $sql_query_insert);
} elseif(isset($_POST['backward'])){
$sql_query_insert="INSERT INTO direction (direction)
VALUES ('backward')";
mysqli_query($connection, $sql_query_insert);
} elseif(isset($_POST['forward'])){
$sql_query_insert="INSERT INTO direction (direction)
VALUES ('forward')";
mysqli_query($connection, $sql_query_insert);
} elseif(isset($_POST['stop'])){
$sql_query_insert="INSERT INTO direction (direction)
VALUES ('stop')";
mysqli_query($connection, $sql_query_insert);
} else
echo "Error database conecction";
?>