-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanner2.php
32 lines (27 loc) · 1009 Bytes
/
banner2.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
<?php
if (isset($_POST['upload']))
{
$target = "banner/".basename($_FILES['image']['name']);
$conn = mysqli_connect("localhost" , "root" , "Josujacob1@" , "travel");
$image = $_FILES['image']['name'];
$description=$_POST['description'];
// $description = mysqli_real_escape_string($conn, $_POST['description']);
$sql = "INSERT INTO banner (image,description) VALUES ('$image','$description')";
// mysqli_query($conn , $sql); //insert images into image table.
if ($conn->query($sql) === TRUE) {
echo "";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
//now lets move data to folder images.
if (@move_uploaded_file($_FILES['image']['tmp_name'] , $target))
{
echo "uploaded successfully";
header('Location:banner.php');
}
else
{
echo "error ".$conn->error;
}
}
?>