forked from sandi3ai/alltime5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
25 lines (19 loc) · 794 Bytes
/
Copy pathinsert.php
File metadata and controls
25 lines (19 loc) · 794 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
<?php
include_once 'db.php';
checkConnection($conn);
//so vse vrednosti podane?
if (!empty($_POST['name']) && !empty($_POST['team']) && !empty($_POST['position']) && !empty($_POST['image'])) {
$name = $_POST['name'];
$team = $_POST['team'];
$position = $_POST['position'];
$image = $_POST['image'];
//insert to db
$sql = "INSERT INTO `player`(`name`, `team`, `position`, `image`) VALUES ('$name', '$team', '$position', '$image')";
if ($conn->query($sql) === true) {
echo json_encode("New player successfully added to database");
} else {
echo json_encode('"Error: " . $sql . "<br>" . $conn->error - error na insert.php');
}
}
$conn->close();
?>