Jump to content

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


FmanTheCoder
Go to solution Solved by iarp,

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>";
    }
  }
}
Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

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.

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.