Parse Error Syntax Error Unexpected T_else
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 more about parse error syntax error unexpected 'else' (t_else) wordpress Stack Overflow the company Business Learn more about hiring developers or posting ads syntax error, unexpected 'else' (t_else) laravel with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow t_else php 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 favorite i
Unexpected Else In R
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.
Your image:"; php else } } } 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= addslashes(file_get_contents($_FILES['image']['tmp_name'])); $img_name= addslashes($_FILES['image']['name']); $img_size = getimagesize($_FILES['image']['tmp_name']); if ($ihere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of parse error: syntax error, unexpected end of file this site About Us Learn more about Stack Overflow the company Business Learn
Unexpected {{else}} Meteor
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Parse Error: Syntax Error, Unexpected $end
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 minute: Sign up http://stackoverflow.com/questions/22562818/parse-error-syntax-error-unexpected-t-else Parse error: syntax error, unexpected 'else' (T_ELSE) [closed] up vote -4 down vote favorite I edit this code to display a mesaje when select is null and i get this error: Parse error: syntax error, unexpected 'else' (T_ELSE) in /nginx/user/reports.php on line 235 This is code: $stmt = $mysqli->prepare("SELECT date, impressions, balance, username FROM reports WHERE username = '$username' and date between '$firstDay' http://stackoverflow.com/questions/21075325/parse-error-syntax-error-unexpected-else-t-else AND '$lastDay'"); $stmt->execute(); $stmt->store_result(); $rows = $stmt->num_rows; mysqli_stmt_bind_result($stmt,$date,$impressions,$balance,$username); if ($rows > 0){ while (mysqli_stmt_fetch($stmt)) { $ecpm_t3 = $balance*1000; $ecpm3 = $ecpm_t3/$impressions; $rate = number_format((float)$ecpm3, 2, '.', ''); echo"
If this is your first visit, be sure to check out http://board.phpbuilder.com/showthread.php?10320304-RESOLVED-Parse-error-syntax-error-unexpected-T_ELSE the 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 visit from the selection below. Page 1 of 2 12 Last Jump to syntax error 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 Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 03-28-2006,07:07 AM #1 syntax error, unexpected 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='$id'";
$result2=mysql_query($sql2);
$rows2=mysql_fetch_array($result2);
$imagename