-
Notifications
You must be signed in to change notification settings - Fork 2
/
insert3.php
50 lines (38 loc) · 1.34 KB
/
insert3.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Insert physical 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="physical";
$Pstationname=$_POST['station_forphysical'];
$Pdepth=$_POST['Pdepth'];
$Ptemperature=$_POST['Ptemperature'];
$Psalinity=$_POST['Psalinity'];
$Poxygen=$_POST['Poxygen'];
$Pfluorescence=$_POST['Pfluorescence'];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO $thetable (Pstationname,Pdepth,Ptemperature,Psalinity,Poxygen,Pfluorescence,Phidden)
VALUES ('$Pstationname[0]',$Pdepth,$Ptemperature,$Psalinity,$Poxygen,$Pfluorescence,0)";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
</body>
</html>