-
Notifications
You must be signed in to change notification settings - Fork 2
/
insert.php
48 lines (36 loc) · 1.06 KB
/
insert.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Insert station data</title>
<meta name="description" content="">
<meta name="author" content="">
</head>
<body>
<?php include_once("header.php");?>
<?php
$servername = "localhost";
$username="root";
$password="LIMS.2017.Uppsala";
$dbname = "Marine";
$thetable="Stations";
$Sname=$_POST['Sname'];
$Ssequence=$_POST['Ssequence'];
$Slongitude=$_POST['Slongitude'];
$Slatitude=$_POST['Slatitude'];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO $thetable (Sname,Ssequence,Slongitude,Slatitude,Shidden)
VALUES ('$Sname',$Ssequence,$Slongitude,$Slatitude,0)";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
</body>
</html>