-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert_record.php
More file actions
43 lines (36 loc) · 1021 Bytes
/
insert_record.php
File metadata and controls
43 lines (36 loc) · 1021 Bytes
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
<!DOCTYPE html> <html>
<head>
<title>Slavernij invoer resultaten</title> </head>
<body>
<h1>Slavernij invoer resultaten</h1>
<?php
// create short variable names
$begindatum=$_POST['begindatum'];
$einddatum=$_POST['einddatum'];
$waarheen=$_POST['werkadres'];
$naam=$_POST['naam'];
$email=$_POST['email'];
$extra=$_POST['extra'];
//localhost
@$db = new mysqli('srv042112.webreus.net', 'u1007310root', 'oLvq5Fcr#HB', 'slavernij');
if (mysqli_connect_errno()) {
echo "<p>Error: Could not connect to database.<br/>
Please try again later.</p>";
exit;
} else {
echo 'connected to liften DB, ready to query slaven table';
}
$query = "INSERT INTO slaven VALUES (?, ?, ?, ?, ?, ?)";
$stmt = $db->prepare($query);
$stmt->bind_param('ssssss', $begindatum, $einddatum, $werkadres, $naam, $email, $extra);
$stmt->execute();
if ($stmt->affected_rows > 0) {
echo "<p>lift inserted into the database.</p>";
} else {
echo "<p>An error has occurred.<br/>
The item was not added.</p>";
}
$db->close();
?>
</body>
</html>