I cant make my upload image work

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"
}
}
 
Please use the code button if you paste code. It's easier to read.

Next, I notice a missing ; at the end of some lines.
 
Also, the quotes are wrong :

Code:
$sql = "INSERT INTO images (image,text) VALUES ('$image',''$text')";
 
you cant possible imagine how emberrased i am right now sorry for wasting your time
 
Back
Top