Parse Error Syntax Error Unexpected T_else Php
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About parse error syntax error unexpected 'else' (t_else) wordpress Us Learn more about Stack Overflow the company Business Learn more about hiring
Syntax Error, Unexpected 'else' (t_else) Laravel
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the php else Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected T_ELSE
Parse Error: Syntax Error, Unexpected $end
up vote 0 down vote favorite i just need help regarding my code becuase i odnt have any idea where is the syntax error. $file = $_FILES['image']['tmp_name']; if (!isset($file)) echo "Please select an image"; else { $image = addslashes(file_get_contents($_FILES['image']['tmp_name'])); $img_name = addslashes($_FILES['image']['name']); $img_size = getimagesize($_FILES['image']['tmp_name']); if ($img_size == FALSE) echo "select valid image."; else { if (!$insert = mysql_query("insert into testblob values('','$image','$img_name')")); echo "Problem uploading!"; else parse error: syntax error, unexpected end of file { $lastid = mysql_insert_id(); echo "Image uploaded.
Your image:
"; } } } i just need to know where is the error. thnaks for the help. more power .. php mysql share|improve this question edited Mar 21 '14 at 15:28 Pavel Štěrba 1,6331629 asked Mar 21 '14 at 15:24 user2699948 816 Which line PHP reports you? –Pavel Štěrba Mar 21 '14 at 15:25 Indenting your code may make the solution obvious. –fedorqui Mar 21 '14 at 15:25 4 i know its possible to do if..else without curly braces, but you really should just always use curly braces even if its only one line... –celeriko Mar 21 '14 at 15:27 also, if (!$insert=mysql_query("insert into testblob values('','$image','$img_name')")); should not have a ; at the end.. –celeriko Mar 21 '14 at 15:27 @celeriko, found my error. thanks! –user2699948 Mar 21 '14 at 15:31 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote You have a semi-colon ; in your conditional statement extra here: if (!$insert=mysql_query("insert into testblob values('','$image','$img_name')")); Remove it and change it to: if (!$insert=mysql_query("insert into testblob values('','$image','$img_name')")) why dont you use this
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta
If Else Php
Discuss the workings and policies of this site About Us Learn
Else If
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like http://stackoverflow.com/questions/22562818/parse-error-syntax-error-unexpected-t-else you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected T_ELSE - WHY? [closed] up vote -1 down vote favorite So I have the following code on my index.php: http://stackoverflow.com/questions/13073038/parse-error-syntax-error-unexpected-t-else-why if the user is logged in. If not, show the login form global $user_ID, $user_identity; get_currentuserinfo(); if (!$user_ID) { ?>