Jump to content

[SOLVED] Parse Error: Unexpected $end - Error


JeanieTallis

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/151956-solved-parse-error-unexpected-end-error/
Share on other sites

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.

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"; 
   ?>

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.

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"; 
   ?>

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! 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.