FmanTheCoder Posted May 3, 2014 Share Posted May 3, 2014 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>"; } } } Quote Link to comment Share on other sites More sharing options...
Solution iarp Posted May 3, 2014 Solution Share Posted May 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
FmanTheCoder Posted May 3, 2014 Author Share Posted May 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.