-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocations3.php
38 lines (29 loc) · 1.12 KB
/
locations3.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
<?php
if (isset($_POST['submit']))
{
$target = "locations/".basename($_FILES['l_image']['name']);
$conn = mysqli_connect("localhost" , "root" , "Josujacob1@" , "travel");
$image = $_FILES['l_image']['name'];
$description=$_POST['l_description'];
$l_name=$_POST['l_name'];
$p_id=$_GET['p_id'];
// $description = mysqli_real_escape_string($conn, $_POST['description']);
$sql = "INSERT INTO locations (l_image,l_description,l_name,p_id) VALUES ('$image','$description','$l_name','$p_id')";
// mysqli_query($conn , $sql); //insert images into image table.
if ($conn->query($sql) === TRUE) {
echo "uploaded successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
//now lets move data to folder images.
if (@move_uploaded_file($_FILES['l_image']['tmp_name'] , $target))
{
echo "uploaded successfully";
header('Location:locations2.php');
}
else
{
echo "error ".$conn->error;
}
}
?>