Jump to content

Parse error: syntax error, unexpected 'echo' (T_ECHO)1


FmanTheCoder

Recommended Posts

I am making a php script to automatically save any files someone uploads to the website to a database. So, if there is an issue with saving the file to the database it creates an output that says that there is an error. When I test the script it says this on the page. 

 

Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:\xampp\htdocs\index.php on line 31

 

 

Does anyone know how to fix this because i really want to finish this website!

Here is the whole if command.

// file properties
$file = $_FILES['image']['tmp_name'];

if (!isset($file))
   echo "Please Select An Image";
else
{
  $image = file_get_contents($_FILES['image']['tmp_name']);
  $image_name = addslashes($_FILES['image']['name']);
  $image_size = getimagesize($_FILES['images']['tmp_name']);
  if ($image_size==FALSE)
     echo "The Specified File Is Not A Picture.";
  else
  {
    if (!$insert = mysql_query("INSTERT INTO image VALUES ('', '$image_name', '$image')")
       echo "Upload Error.";
    else
    {
   $lastid = mysql_insert_id();
   echo "Image Uploaded.<p />Your Image:<p /><img src=get.php>";
    }
  }
}

You're missing a closing bracket at the end of the INSERT statement line.

 

I see one opening at the if and another at the mysql_query but only 1 closing.

 

Plus you've spent INSERT wrong.

Thanks man! I'm really new at php and not that good.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.