Xyphon Posted December 28, 2007 Share Posted December 28, 2007 I get an unexpected T_ELSE on line 42 <?PHP include('Connect.php'); include('top.php'); $ID = $_COOKIE['UserID']; if(!isset($ID)) { echo "You must be logged in to view this page"; } include('bottom.php'); exit; $Result = mysql_query("SELECT * FROM users WHERE ID='$ID'") or die (mysql_error()); while($Rows = mysql_fetch_array($Result)) { if($Rows['story_area']=="1") { if($Rows['gender']=="Male") { if(isset($_POST['submit'])) { echo "Announcer: The Pokébowl, who'll win it tonight folks? Over here we have the Charmanders!<br /> Captain: Char, Charmander *LETS GET HIM GUYS!*<br /> Announcer: And over here we have.. The Squirtles!<br /> Captain2: SQUIRT, SQUIRTLE!! *C'MON! BRING IT ON!*<br /> Announcer2: This will be a big game! Two rivals in the final match! Go go go!<br /> 58 minutes later..<br /> Announcer: This si a close one! 48-48 Tie game! The Squirtle captain ahs the ball! Hes going in for the kill! The 30, the 20, the 10, the 5! TOUCHDOWN!<br /> Announcer2: That was some game, bob!<br /> Announcer: Yes it was, Jim! 48- 54!<br /> Jimmy: That was a good game. but I think you should go home now.<br /> <form method='post'> <input type='submit' name='home' value='Head Home'></form>"; } else { echo "Jimmy: Hi, " . $Rows['username'] . "I'm heading to the Pokébowl later, wanna come? I got tickets! Front row center!<br />" . $Rows['username'] . ": Nah. I promised I'd help my mom with some chores..<br /> Jimmy: Aw! On Pokébowl night! C'mon! You gotta come!<br />" . $Rows['username'] . ": Hmm.. I guess my mom wouldn't mind. Okay, I'll go!<br /> <form method='post'> <input type='submit' name='submit' value='proceed'></form>"; } else { echo "Blah"; } else { echo "Blah 2"; } } include('bottom.php') ?> I just cant seem to find out why.. Help? Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/ Share on other sites More sharing options...
pocobueno1388 Posted December 28, 2007 Share Posted December 28, 2007 Indenting your code will make it a lot easier to find the problem. Your not closing your bracket to this line while ($Rows = mysql_fetch_array($Result)) { Or this line if ($Rows['story_area']=="1") { Here is an indented version of your code <?php include('Connect.php'); include('top.php'); $ID = $_COOKIE['UserID']; if (!isset($ID)) { echo "You must be logged in to view this page"; } include('bottom.php'); exit; $Result = mysql_query("SELECT * FROM users WHERE ID='$ID'") or die(mysql_error()); while ($Rows = mysql_fetch_array($Result)) { if ($Rows['story_area']=="1") { if ($Rows['gender']=="Male") { if (isset($_POST['submit'])) { echo "Announcer: The Pokébowl, who'll win it tonight folks? Over here we have the Charmanders!<br /> Captain: Char, Charmander *LETS GET HIM GUYS!*<br /> Announcer: And over here we have.. The Squirtles!<br /> Captain2: SQUIRT, SQUIRTLE!! *C'MON! BRING IT ON!*<br /> Announcer2: This will be a big game! Two rivals in the final match! Go go go!<br /> 58 minutes later..<br /> Announcer: This si a close one! 48-48 Tie game! The Squirtle captain ahs the ball! Hes going in for the kill! The 30, the 20, the 10, the 5! TOUCHDOWN!<br /> Announcer2: That was some game, bob!<br /> Announcer: Yes it was, Jim! 48- 54!<br /> Jimmy: That was a good game. but I think you should go home now.<br /> <form method='post'> <input type='submit' name='home' value='Head Home'></form>"; } else { echo "Jimmy: Hi, " . $Rows['username'] . "I'm heading to the Pokébowl later, wanna come? I got tickets! Front row center!<br />" . $Rows['username'] . ": Nah. I promised I'd help my mom with some chores..<br /> Jimmy: Aw! On Pokébowl night! C'mon! You gotta come!<br />" . $Rows['username'] . ": Hmm.. I guess my mom wouldn't mind. Okay, I'll go!<br /> <form method='post'> <input type='submit' name='submit' value='proceed'></form>"; } else { echo "Blah"; } else { echo "Blah 2"; } } include('bottom.php') ?> Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/#findComment-424434 Share on other sites More sharing options...
Xyphon Posted December 28, 2007 Author Share Posted December 28, 2007 Its closed at the bottom, both of them. Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/#findComment-424436 Share on other sites More sharing options...
pocobueno1388 Posted December 28, 2007 Share Posted December 28, 2007 Its closed at the bottom, both of them. Check again. They aren't. Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/#findComment-424437 Share on other sites More sharing options...
Xyphon Posted December 28, 2007 Author Share Posted December 28, 2007 I forgot to close 1. The other 2 are. Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/#findComment-424438 Share on other sites More sharing options...
pocobueno1388 Posted December 28, 2007 Share Posted December 28, 2007 Try changing your code to this <?php include('Connect.php'); include('top.php'); $ID = $_COOKIE['UserID']; if (!isset($ID)) { echo "You must be logged in to view this page"; } include('bottom.php'); exit; $Result = mysql_query("SELECT * FROM users WHERE ID='$ID'") or die(mysql_error()); while ($Rows = mysql_fetch_array($Result)) { if ($Rows['story_area']=="1") { if ($Rows['gender']=="Male") { if (isset($_POST['submit'])) { echo "Announcer: The Pokébowl, who'll win it tonight folks? Over here we have the Charmanders!<br /> Captain: Char, Charmander *LETS GET HIM GUYS!*<br /> Announcer: And over here we have.. The Squirtles!<br /> Captain2: SQUIRT, SQUIRTLE!! *C'MON! BRING IT ON!*<br /> Announcer2: This will be a big game! Two rivals in the final match! Go go go!<br /> 58 minutes later..<br /> Announcer: This si a close one! 48-48 Tie game! The Squirtle captain ahs the ball! Hes going in for the kill! The 30, the 20, the 10, the 5! TOUCHDOWN!<br /> Announcer2: That was some game, bob!<br /> Announcer: Yes it was, Jim! 48- 54!<br /> Jimmy: That was a good game. but I think you should go home now.<br /> <form method='post'> <input type='submit' name='home' value='Head Home'></form>"; } else { echo "Jimmy: Hi, " . $Rows['username'] . "I'm heading to the Pokébowl later, wanna come? I got tickets! Front row center!<br />" . $Rows['username'] . ": Nah. I promised I'd help my mom with some chores..<br /> Jimmy: Aw! On Pokébowl night! C'mon! You gotta come!<br />" . $Rows['username'] . ": Hmm.. I guess my mom wouldn't mind. Okay, I'll go!<br /> <form method='post'> <input type='submit' name='submit' value='proceed'></form>"; } else { echo "Blah"; } else { echo "Blah 2"; } } } } include('bottom.php') ?> Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/#findComment-424439 Share on other sites More sharing options...
Xyphon Posted December 28, 2007 Author Share Posted December 28, 2007 Oh, you're right, they werent closed. now they are, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/83426-solved-unexpected-t_else/#findComment-424441 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.