<?php
$uploadmsg = "";
//if upload button is pressed
if (isset($_POST['upload'])) {
$target = "images/".basename($_FILES['image']['name']);
//connect to the database
$db = mysql_connect("localhost", "root", "", "photo");
// get all the submitted data from the form
$image = $_FILES['image']['name'];
$text = $_POST['text'];
$sql = "INSERT INTO photo(image, text) VALUES ('$image', '$text')";
$result = mysql_query($db, $sql);
// move the uploaded image into the folder: images
if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
$uploadmsg = "Image uploaded Successfully!";
}else {
$uploadmsg = "There was a problem uploading image";
}
}
?>
View attachment 307252
pa help nmn guys bkt gnun ung error
$uploadmsg = "";
//if upload button is pressed
if (isset($_POST['upload'])) {
$target = "images/".basename($_FILES['image']['name']);
//connect to the database
$db = mysql_connect("localhost", "root", "", "photo");
// get all the submitted data from the form
$image = $_FILES['image']['name'];
$text = $_POST['text'];
$sql = "INSERT INTO photo(image, text) VALUES ('$image', '$text')";
$result = mysql_query($db, $sql);
// move the uploaded image into the folder: images
if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
$uploadmsg = "Image uploaded Successfully!";
}else {
$uploadmsg = "There was a problem uploading image";
}
}
?>
View attachment 307252
pa help nmn guys bkt gnun ung error