JeanieTallis Posted March 31, 2009 Share Posted March 31, 2009 I recieve this error on http://www.myvee.co.uk/admin/user_online.php parse error: syntax error, unexpected $end in /home/myveeco/public_html/admin/users_online.php on line 64 However, I don't have a line 64. Help me out with it. Here is the code for Users_Online.php <? include("../include/session.php"); if(!$session->isAdmin()){ header("Location: ../index.php"); } else{ ?> <title>MyVee! User Online</title> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <link href="../Style4.css" rel="stylesheet" type="text/css"> <div id="wrapper"> <div id="Layer4"> <div style="color:WHITE;"> <script type="text/javascript"> var d=new Date() var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") document.write(weekday[d.getDay()] + " ") document.write(d.getDate() + ". ") document.write(monthname[d.getMonth()] + " ") document.write(d.getFullYear()) </script> </div></div> <div id="Layer2"></div> <div id="Layer1"></div> <div id="Layer3"> <p>[ <a href="http://www.myvee.co.uk">Back</a> ]<br> <p> <? include("../include/view_active_admin.php"); ?> </html> </div> </div> Whats causing the error and where should it go. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/ Share on other sites More sharing options...
thebadbad Posted March 31, 2009 Share Posted March 31, 2009 You're missing a closing curly bracket, after your last include(). And please use full PHP opening tags <?php, instead of the short tags. Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-797961 Share on other sites More sharing options...
JeanieTallis Posted March 31, 2009 Author Share Posted March 31, 2009 Sorry, some people prefer it without them as its easier to read for them. I included that bracket too, same error still shows. Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-797967 Share on other sites More sharing options...
Brian W Posted March 31, 2009 Share Posted March 31, 2009 Short tags are bad practice for a couple of reasons. Serious application developers recommend not using short tags, which was good enough for me, they know what they are doing. <?php include("../include/session.php"); if(!$session->isAdmin()){ header("Location: ../index.php"); } else{ ?> <title>MyVee! User Online</title> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <link href="../Style4.css" rel="stylesheet" type="text/css"> <div id="wrapper"> <div id="Layer4"> <div style="color:WHITE;"> <script type="text/javascript"> var d=new Date() var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") document.write(weekday[d.getDay()] + " ") document.write(d.getDate() + ". ") document.write(monthname[d.getMonth()] + " ") document.write(d.getFullYear()) </script> </div></div> <div id="Layer2"></div> <div id="Layer1"></div> <div id="Layer3"> <p>[ <a href="http://www.myvee.co.uk">Back</a> ]<br> <p> <?php include("../include/view_active_admin.php"); ?> </html> </div> </div> <?php } ?> If you try that and you are still getting the error, the problem is in one of your include files. Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-797974 Share on other sites More sharing options...
JeanieTallis Posted March 31, 2009 Author Share Posted March 31, 2009 The only include file which would have the error, the rest work like a charm, the only one that wouldnt work is the following code <?php echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n"; echo "<tr><td><font size=\"2\">\n"; for($i=0; $i<$num_rows; $i++){ $uname = mysql_result($result,$i,"username"); echo "<a href=\"userinfo.php?user=$uname\">$uname</a> / "; } echo "</font></td></tr></table><br>\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-797987 Share on other sites More sharing options...
Brian W Posted March 31, 2009 Share Posted March 31, 2009 Is it giving you an error? The brackets balance... Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-797992 Share on other sites More sharing options...
JeanieTallis Posted March 31, 2009 Author Share Posted March 31, 2009 How would I check it for an error, it doesn't seem to be giving me one. Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-797996 Share on other sites More sharing options...
JeanieTallis Posted March 31, 2009 Author Share Posted March 31, 2009 I have checked the include file, and i copied the code what is to display what I wanted. This works, so it is the in user_online.php file, nothing wrong with the include file. Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-798013 Share on other sites More sharing options...
Brian W Posted March 31, 2009 Share Posted March 31, 2009 do you have error reporting on in your INI? if not, add this to the top: <?php error_reporting(E_ALL); ?> This ran by itself should not work because $result doesn't exist... <?php echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n"; echo "<tr><td><font size=\"2\">\n"; for($i=0; $i<$num_rows; $i++){ $uname = mysql_result($result,$i,"username"); echo "<a href=\"userinfo.php?user=$uname\">$uname</a> / "; } echo "</font></td></tr></table><br>\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-798018 Share on other sites More sharing options...
JeanieTallis Posted March 31, 2009 Author Share Posted March 31, 2009 I found the problem, like thebadbad said, needed a close bracket, though, this had to be placed <?php } <---- HERE include("../include/view_active_admin.php"); ?> [code] Thanks guys for telling me what I needed! Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-798026 Share on other sites More sharing options...
JeanieTallis Posted March 31, 2009 Author Share Posted March 31, 2009 For the add; how do I set my topics as solved? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-798028 Share on other sites More sharing options...
premiso Posted March 31, 2009 Share Posted March 31, 2009 Bottom left hand corner above the "Quick Reply". Quote Link to comment https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/#findComment-798030 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.