Fenhopi Posted March 20, 2010 Share Posted March 20, 2010 Here's my code: </head> <body bgcolor="Silver"> <table> <tr><td> <? /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<ul><h1>Logged In</h1>"; echo "Welcome <b>$session->username</b>, you are logged in. <br><br>" ?> <li><p class="normal">[<a href=\"userinfo.php?user=$session->username\">My Account</a>] </a></li></p>" <li>[<a href=\"useredit.php\">Edit Account</a>] </li>"; <? if($session->isAdmin()){ ?> <li>[<a href=\"admin/admin.php\">Admin Center</a>] </li>" <li>[<a href=\"process.php\">Logout</a>]</li></ul>" <? else: ?> The else function on the end is followed by the code I have for the login. If I remove the else function, just to try and run the code I get an error on a line number that doesn't exist. Please help. Link to comment https://forums.phpfreaks.com/topic/195946-why-does-this-else-give-an-error/ Share on other sites More sharing options...
Ruzzas Posted March 21, 2010 Share Posted March 21, 2010 </head> <body bgcolor="Silver"> <table> <tr><td> <? /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<ul><h1>Logged In</h1>"; echo "Welcome <b>$session->username</b>, you are logged in. <br><br>" ?> <li><p class="normal">[<a href=\"userinfo.php?user=$session->username\">My Account</a>] </a></li></p>" <li>[<a href=\"useredit.php\">Edit Account</a>] </li>"; <? if($session->isAdmin()){ ?> <li>[<a href=\"admin/admin.php\">Admin Center</a>] </li>" <li>[<a href=\"process.php\">Logout</a>]</li></ul>" <?}?> Try that Link to comment https://forums.phpfreaks.com/topic/195946-why-does-this-else-give-an-error/#findComment-1029403 Share on other sites More sharing options...
greatstar00 Posted March 21, 2010 Share Posted March 21, 2010 it is because u didnt close the }, before using else Link to comment https://forums.phpfreaks.com/topic/195946-why-does-this-else-give-an-error/#findComment-1029426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.