A
Anonymous
Guest
Hey, im doing a php scripted website via sql and i need to make a upload button and i have done so but it tells me unexpected if on line 4
Here is the code and i would appreciate any help!
<?php
$msg =""
//if upload button is pressed//
if (isset($_POST['up'])) {
$target = "images/". basename($_FILES['image']['name']);
//connect to database
$db=mysqli_connect("localhost","root","","photos");
//get all the sumbitted data from the form
$image = $_FILES['image']['name'];
$text = $_POST['text'];
$sql = "INSERT INTO images (image,text) VALUES ('$image',''$text')";
mysqli_query($db,$sql)//lagre vores data i databasen
//bevæg dataene
if(move_uploaded_file)($FILES['tmp_name']['name'],$target)){
$msg ="Uploaded!";
}else{
$msg ="Der var et problem"
}
}
Here is the code and i would appreciate any help!
<?php
$msg =""
//if upload button is pressed//
if (isset($_POST['up'])) {
$target = "images/". basename($_FILES['image']['name']);
//connect to database
$db=mysqli_connect("localhost","root","","photos");
//get all the sumbitted data from the form
$image = $_FILES['image']['name'];
$text = $_POST['text'];
$sql = "INSERT INTO images (image,text) VALUES ('$image',''$text')";
mysqli_query($db,$sql)//lagre vores data i databasen
//bevæg dataene
if(move_uploaded_file)($FILES['tmp_name']['name'],$target)){
$msg ="Uploaded!";
}else{
$msg ="Der var et problem"
}
}