-
Notifications
You must be signed in to change notification settings - Fork 1
/
insert.php
27 lines (23 loc) · 937 Bytes
/
insert.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
<?php
$db_host="localhost";
$db_user="root";
$db_passwd="1324";
$db_name="bucketlist";
$conn = mysqli_connect($db_host, $db_user, $db_passwd, $db_name);
$id = $_POST['ID'];
$title = $_POST['TITEL'];
$local = $_POST['LOCAL'];
$complete = $_POST['COMPLT'];
$tdate = $_POST['TDATE'];
$body = mysqli_real_escape_string($conn, $_POST['BODY']);
$ident_num = $_POST['IDNT_NUM'];
$image = $_POST['IMAGE'];
$data=base64_decode($image);
$escaped_values = mysqli_real_escape_string($conn, $data);
if($ident_num == "0"){
$sql = "INSERT INTO $id VALUES (null, '$title', '$local', '$complete', '$tdate', '$body', '$escaped_values')";
}else{
$sql = "UPDATE $id SET title='$title', locate='$local', complete='$complete', target_date='$tdate', body='$body', image='$escaped_values' WHERE ident='$ident_num'";
}
$result = mysqli_query($conn, $sql);
?>