Parse Error Syntax Error Unexpected T_else In
Contents |
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 Us Learn parse error syntax error unexpected 'else' (t_else) wordpress more about Stack Overflow the company Business Learn more about hiring developers or posting syntax error, unexpected 'else' (t_else) laravel ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack t_else php 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 up vote 0 down vote php else 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 { $lastid = mysql_insert_id(); echo "Image uploaded.
Parse Error: Syntax Error, Unexpected End Of File
/>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 better ? $file= $_FILES['image']['tmp_name']; if (!isset($file)){ echo "Please select an image"; } else{ $image= addslashhere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
If Else Php
policies of this site About Us Learn more about Stack Overflow the company else if Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users w3schools Badges Ask Question x Dismiss Join the 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 http://stackoverflow.com/questions/22562818/parse-error-syntax-error-unexpected-t-else minute: Sign up Unexpected T_ELSE error in PHP [closed] up vote 2 down vote favorite 3 I am working on an example from a php book and am getting an error on line 8 with this code http://stackoverflow.com/questions/2642512/unexpected-t-else-error-in-php "You are using Mozilla firefox"; } else {$result = "you are using $agent"; } echo $result; ?> php if-statement syntax-error share|improve this question edited Dec 24 '12 at 23:47 hakre 134k26216390 asked Apr 15 '10 at 3:17 Jacksta 45541220 closed as off-topic by PeeHaa, cryptic ツ, Madara Uchiha♦, hakre, TimWolla Feb 17 '14 at 0:14 This question appears to be off-topic. The users who voted to close gave this specific reason:"This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – PeeHaa, cryptic ツ, Madara Uchiha, hakre, TimWollaIf this question can be reworded to fit the rules in the help center, please edit the question. add a comment| 4 Answers 4 active oldest votes up vote 6 down vote accepted Try: $agent = getenv("HTTP_USER_AGENT"); if (preg_match("/MSIE/i", $agent)) { $result = "You are using Microsoft Internet Explorer";
If this is your http://board.phpbuilder.com/showthread.php?10320304-RESOLVED-Parse-error-syntax-error-unexpected-T_ELSE first visit, be sure to check out the https://www.codecademy.com/en/forum_questions/55c44affd3292f742c0000b5 FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to syntax error visit from the selection below. Page 1 of 2 12 Last Jump to page: Results 1 to 15 of 19 Thread: [RESOLVED] Parse error: syntax error, unexpected T_ELSE Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this parse error syntax Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 03-28-2006,07:07 AM #1 lpxxfaintxx View Profile View Forum Posts Junior Member Join Date Mar 2006 Posts 20 [RESOLVED] Parse error: syntax error, unexpected T_ELSE Parse error: syntax error, unexpected T_ELSE in /home/lpxxfain/public_html/memberseditimages.php on line 104 PHP Code: require_once"maincore.php";
require_once"subheader.php";
require_once"side_left.php";
$username=$userdata['user_name'];
$id=$_GET['editid'];
$sql2="SELECT*FROMregistered_filesWHEREid=
Flow: Switch Forum View Course » View Exercise 1146 points Submitted by Boris Atanasov about 1 year ago Gives me 'Parse error: syntax error, unexpected T_ELSE on line 13 ' Where I do a mistake? It pass me but with that error. 3) { echo "Drink water!"; } elseif ($var < 13); { echo "Drink more water!"; } else { **// this is line 13** echo "this is not a number! Please add only a number!"; } ?> I'd like to know also which ones are already unnecessary to use (brackets) with php code as I read in previous post in the forum here. Thanks!