Jump to content

Parse error: syntax error, unexpected T_STRING received when uploading files


Dave2136

Recommended Posts

I have been trying to get my files to upload onto a computer and I receive this message: Parse error: syntax error, unexpected T_STRING in /home/content/19/6550319/html/listing.php on line 27. Line 27 is how the php logs into my SQL. The problem is that I was able to log in before. I just made changes to the form by adding a dropdown menu and price and now it says it doesnt parse.

 

Can anyone figure this out. I will include the code without the login information because the forum is public but I did put the words left out for you to see where I took out the passcodes.

 

<?php




//This is the directory where images will be saved
$target = "potofiles/";
$target = $target . basename( $_FILES['photo']['name']);

//This gets all the other information from the form
$price=$_POST['price'];
$gig=$_POST['giga'];
$yesg=$_POST['yesg'];
$pic=($_FILES['photo']['name']);
$pic2=($_FILES['phototwo']['name']);
$pic3=($_FILES['photothree']['name']);
$pic4=($_FILES['photofour']['name']);
$description=$_POST['iPadDescription'];
$condition=$_POST['condition'];
$fname=$_POST['firstName'];
$lname=$_POST['lastName'];
$email=$_POST['email']



// Connects to your Database
mysql_connect ("left out", "left out", "left out") or die(mysql_error()) ;
mysql_select_db("left out") or die(mysql_error()) ;

//Writes the information to the database
mysql_query("INSERT INTO listing (price,giga,yesg,photo,phototwo,photothree,photofour,iPadDescription,condition,firstName,lastName,email)
VALUES ('$price', '$gig', '$yesg', '$pic', '$pic2', '$pic3', '$pic4', '$description', '$condition', '$fname', '$lname', '$email')") ;

//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{

//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else {

//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}

echo date("m/d/y : H:i:s", time()) 


?>

 

Link to comment
Share on other sites

Thank you so much! I was pulling my hair out and getting upset to the point of wanting to just give up. I read the code probably 50 times yesterday and I cant believe I missed that! It now works. It is funny how we sometimes need someone elses eyes to see things.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.