-
Notifications
You must be signed in to change notification settings - Fork 2
/
insert2.php
55 lines (41 loc) · 1.35 KB
/
insert2.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Insert biological 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="Biological";
//$Bstationname=$_POST['Bstationname'];
$Bstationname=$_POST['station_forbiological'];
$Bstratummin=$_POST['Bstratummin'];
$Bstratummax=$_POST['Bstratummax'];
$Bx=$_POST['Bx'];
$B_y=$_POST['B_y'];
$Blarvastage=$_POST['Blarvastage'];
$Bspecies=$_POST['Bspecies'];
$Babundance=$_POST['Babundance'];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO $thetable (Bstationname,Bstratummin,Bstratummax,Bx,B_y,Blarvastage,Bspecies,Babundance,Bhidden)
VALUES ('$Bstationname[0]',$Bstratummin,$Bstratummax,$Bx,$B_y,'$Blarvastage','$Bspecies',$Babundance,0)";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
</body>
</html>