-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddCoding.php
More file actions
28 lines (23 loc) · 877 Bytes
/
addCoding.php
File metadata and controls
28 lines (23 loc) · 877 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
<?php
include("connection.php");
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
echo "Coding not registered.";
die("Connection failed: " . mysql_error());
}
if ($_POST["type"]=="i") {
$boundaries = $_POST["x1"] . ":" . $_POST["y1"] . ":" . $_POST["x2"] . ":" . $_POST["y2"];
}
if ($_POST["type"]=="v") {
$boundaries = $_POST["x1"] . ":" . $_POST["y1"];
}
$sql = "INSERT INTO sourceCoding (source_id, codes_id, boundaries, owner, status, memo) VALUES ('" . $_POST["source_id"] . "','" . $_POST["codes_id"] . "','" . $boundaries . "','" . $_POST["owner"] . "','" . $_POST["status"] . "','" . $_POST["memo"] ."')";
if (mysqli_query($conn, $sql)) {
echo "New coding registered!";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>