Jump to content

[SOLVED] parse error


chris_rulez001

Recommended Posts

hi i have an error, here it is: Parse error: parse error, unexpected $ in /www/1111mb.com/c/h/r/chrisrulez/htdocs/forumtests/index.php on line 222

 

my code:

 

<?php
session_start()
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> - Home</title>
<link rel="stylesheet" href="css/stylesheet.css" />
</head>

<body text="000000" bgcolor="F1F1F1" link="003399" vlink="003399" alink="003399"> 
<?php
$host="localhost"; // Host name
$username="*******"; // Mysql username
$password="******"; // Mysql password
$db_name="*******"; // Database name
$tbl_name="boards"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result=mysql_query($sql);
?>

<?php
$host="localhost"; // Host name
$username="********"; // Mysql username
$password="***"; // Mysql password
$db_name="**************"; // Database name
$tbl_name1="users"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql1="SELECT * FROM $tbl_name1 ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result1=mysql_query($sql1);
?>

<?php
while($rows1 = mysql_fetch_array($result1)){ // Start looping table row
?>
<br />
<table border="0" width="92%" cellspacing="0" cellpadding="0" style="border-color:#000000" align="center">
<tr>
<td width="100%">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>

<td width="27%" height="50" align="center" bgcolor="F1F1F1" class="welcomebg"> </td>
<td width="73%" bgcolor="F1F1F1" class="welcomebg" align="center">
<p><font size="2">
<?php if (!isset($_SESSION['username']) == false) echo "Welcome, ".$_SESSION['displayname']."";
else{
echo "Welcome, Guest, Please <a href='login.php'>Login</a> or <a href='register.php'>Register</a>"; }?><br/>
<?php $date = date("l F d, g i a"); echo $date; ?>
</font><br /></p>
</td>
</tr>

</table>
</td>
</tr><tr>
<td align="center">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" align="center">
<table border="0" width="100%" cellpadding="3" cellspacing="0" align="center">
<tr>
<td class="menubg" valign="middle" bgcolor="EFEFEF" align="center"><font size="1">
<a href="/index.php">Home</a> <a href="/help.php">Help</a> <a href="/members.php">Members</a> <a href="/profile.php">Profile</a><?php if ($rows1['user_level'] == "admin") echo " <a href='admin.php'>Admin Panel</a>"; else { echo ""; } ?> <?php if (!isset($_SESSION['username']) == false) echo "<a href='logout.php'>Logout</a>";
else{
echo "<a href='login.php'>Login</a> <a href='register.php'>Register</a>"; }?>
</font></td>
</tr>
</table>
</td>
</tr>
</table>

</td>
</tr>
</table>
<br />

<center></center><br />
<br />
<table width="92%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" width="100%">
      <br />
<a href="/index.cgi" class="nav"></a> :: Home<br/>
<?php
while($rows = mysql_fetch_array($result)){ // Start looping table row
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor">
<tr>
<td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td class="titlebg" bgcolor="4080B0" colspan="2">
<font class="titletext" color="F1F1F1" size="-1"><b>Board Name</b></font></td>
<td class="titlebg" bgcolor="4080B0" width="1%" align="center"><font class="titletext" color="F1F1F1" size="-1"><b> Topics</b></font></td>
<td class="titlebg" bgcolor="4080B0" width="1%" align="center">
<font class="titletext" color="F1F1F1" size="-1"><b>Posts</b></font>
</td>
<td class="titlebg" bgcolor="4080B0" width="24%" align="center">
<font class="titletext" color="F1F1F1" size="-1"><b>Last Post</b></font>
</td>
</tr>
<tr>
<td colspan="5" class="catbg" bgcolor="DADADA" height="18">
<font size="2" class="cattext" color="0E0E0E"><b><?php echo $rows['catogory']; ?></b></font>
</td>
</tr>
<tr>
<td class="windowbg" bgcolor="EFEFEF" width="8%" align="center" valign="middle">
</td>
<td class="windowbg2" bgcolor="F6F6F6" align="left" width="66%" valign="top" style="cursor:pointer;" onClick="if(!pb_bubble)location.href='/index.cgi?board=updates';" onMouseOver="mouseOverHighlightCell(this);setWindowStatus('Upgrades / News Board');return true;"  onmouseout="mouseOutHighlightCell(this);setWindowStatus('');return true;">
<font size="2"><a href="view_board.php?board=<?php echo $rows['board']; ?>"><?php echo $rows['boardname']; ?></a></font><br/>
<font size="1"><?php echo $rows['description']; ?><br/></font>
</td>
<td class="windowbg" bgcolor="EFEFEF" valign="middle" align="center" width="1%">
<font size="2"><? echo $rows['topics']; ?></font>
</td>
<td class="windowbg" bgcolor="EFEFEF" valign="middle" align="center" width="1%">
<font size="2"><? echo $rows['posts']; ?></font>
</td>
<td class="windowbg2" bgcolor="F6F6F6" width="24%" valign="top">
<font size="1"></font>
</td>
</tr>
<?php
// Exit looping and close connection
}
mysql_close();
?>
<tr>
<td colspan="5" align="right" class="catbg" bgcolor="DADADA" height="18"><font size="2" class="cattext" color="0E0E0E">Mark All Boards As Read <a href="/index.cgi?action=markallboardsread"></a></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br/>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor">
<tr>
<td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="4080B0" class="titlebg" align="center" colspan="2">
<font class="text1" color="F1F1F1" size="2"><b>Info Center</b></font>
</td>
</tr>
<tr>
<td class="catbg" bgcolor="DADADA" colspan="2">
<font size="2" class="cattext" color="0E0E0E"><b>Forum Statistics</b></font>
</td>
</tr>
<tr>

<td class="windowbg2" bgcolor="F6F6F6" valign="top" align="center">
<table width="98%" cellpadding="3" align="center"><tr><td valign="top" align="left" width="60%">
<font size="1">Total Topics:    -   Total Posts: <br/>
Last Updated Topic: by <br/>View the <a href="/index.cgi?action=recent">10 most recent posts</a> of this forum.</font>
</td>
<td valign="top" align="left" width="40%">
<font size="1">Total Members: <a href="/index.cgi?action=members">0</a><br/>Newest Member: <br/>Your Private Messages: <a href="/index.cgi?action=pm">0</a> New: <a href="/index.cgi?action=pm">0</a></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="catbg" bgcolor="DADADA" colspan="2">
<font size="2" class="cattext" color="0E0E0E"><b>Today's Birthdays</b></font>
</td>
</tr>
<tr>

<td class="windowbg2" bgcolor="F6F6F6" valign="top">
<table width="98%" cellpadding="3" align="center">
<tr>
<td valign="top" align="left">
<font size="1"> birthdays today.<br/></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="catbg" bgcolor="DADADA" colspan="2">
<font size="2" class="cattext" color="0E0E0E"><b>Users Online</b></font>
</td>
</tr>
<tr>

<td class="windowbg2" bgcolor="F6F6F6"><table width="98%" cellpadding="3" align="center">
<tr>
<td valign="top" align="left"><font size="1">1 Staff Members, 0 Members, 0 Guests, 0 Invisible Users.
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
    </td>
  </tr>
</table>
<center></center>
</body>
</html>

Link to comment
Share on other sites

One quick look shows me this:

<a href="/index.php">Home</a> <a href="/help.php">Help</a> <a href="/members.php">Members</a> <a href="/profile.php">Profile</a><?php if ($rows1['user_level'] == "admin") echo " <a href='admin.php'>Admin Panel</a>"; else { echo ""; } ?> <?php if (!isset($_SESSION['username']) == false) echo "<a href='logout.php'>Logout</a>";
else{
echo "<a href='login.php'>Login</a> <a href='register.php'>Register</a>"; }?>

The error is there.

Link to comment
Share on other sites

Stay consistent...

 

<a href="/index.php">Home</a> <a href="/help.php">Help</a> <a href="/members.php">Members</a> 
<a href="/profile.php">Profile</a>
<?php if ($rows1['user_level'] == "admin") { echo " <a href='admin.php'>Admin Panel</a>"; }else { echo ""; } ?> 
<?php if (!isset($_SESSION['username'])) { echo "<a href='logout.php'>Logout</a>"; }else {
echo "<a href='login.php'>Login</a> <a href='register.php'>Register</a>"; } ?>

 

Also you do not need to do the == false, the ! assumes the == false portion.

Link to comment
Share on other sites

Well let's try changing this part too:

 

<p><font size="2">
<?php if (!isset($_SESSION['username'])) { echo "Welcome, ".$_SESSION['displayname'].""; }else{
echo "Welcome, Guest, Please <a href='login.php'>Login</a> or <a href='register.php'>Register</a>"; }?><br/>
<?php $date = date("l F d, g i a"); echo $date; ?>

Link to comment
Share on other sites

ive changed that but now im getting another error:

 

Parse error: syntax error, unexpected $end in /home/www/hostsareus.awardspace.co.uk/forum/index.php on line 221

 

code:

 

<?php
session_start()
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> - Home</title>
<link rel="stylesheet" href="css/stylesheet.css" />
</head>

<body text="000000" bgcolor="F1F1F1" link="003399" vlink="003399" alink="003399"> 
<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="forum"; // Database name
$tbl_name="boards"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result=mysql_query($sql);
?>

<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="forum"; // Database name
$tbl_name1="users"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql1="SELECT * FROM $tbl_name1 ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result1=mysql_query($sql1);
?>

<?php
while($rows1 = mysql_fetch_array($result1)){ // Start looping table row
?>
<br />
<table border="0" width="92%" cellspacing="0" cellpadding="0" style="border-color:#000000" align="center">
<tr>
<td width="100%">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>

<td width="27%" height="50" align="center" bgcolor="F1F1F1" class="welcomebg"> </td>
<td width="73%" bgcolor="F1F1F1" class="welcomebg" align="center">
<p><font size="2">
<?php if (!isset($_SESSION['username'])) { echo "Welcome, ".$_SESSION['displayname'].""; }else{
echo "Welcome, Guest, Please <a href='login.php'>Login</a> or <a href='register.php'>Register</a>"; }?><br/>
<?php $date = date("l F d, g i a"); echo $date; ?>
</font><br /></p>
</td>
</tr>

</table>
</td>
</tr><tr>
<td align="center">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" align="center">
<table border="0" width="100%" cellpadding="3" cellspacing="0" align="center">
<tr>
<td class="menubg" valign="middle" bgcolor="EFEFEF" align="center"><font size="1">
<a href="/index.php">Home</a> <a href="/help.php">Help</a> <a href="/members.php">Members</a> <a href="/profile.php">Profile</a><?php if ($rows1['user_level'] == "admin") { echo " <a href='admin.php'>Admin Panel</a>"; }else { echo ""; } ?> 
<?php if (!isset($_SESSION['username'])) { echo "<a href='logout.php'>Logout</a>"; }else {
echo "<a href='login.php'>Login</a> <a href='register.php'>Register</a>"; } ?>
</font></td>
</tr>
</table>
</td>
</tr>
</table>

</td>
</tr>
</table>
<br />

<center></center><br />
<br />
<table width="92%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" width="100%">
      <br />
<a href="/index.cgi" class="nav"></a> :: Home<br/>
<?php
while($rows = mysql_fetch_array($result)){ // Start looping table row
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor">
<tr>
<td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td class="titlebg" bgcolor="4080B0" colspan="2">
<font class="titletext" color="F1F1F1" size="-1"><b>Board Name</b></font></td>
<td class="titlebg" bgcolor="4080B0" width="1%" align="center"><font class="titletext" color="F1F1F1" size="-1"><b> Topics</b></font></td>
<td class="titlebg" bgcolor="4080B0" width="1%" align="center">
<font class="titletext" color="F1F1F1" size="-1"><b>Posts</b></font>
</td>
<td class="titlebg" bgcolor="4080B0" width="24%" align="center">
<font class="titletext" color="F1F1F1" size="-1"><b>Last Post</b></font>
</td>
</tr>
<tr>
<td colspan="5" class="catbg" bgcolor="DADADA" height="18">
<font size="2" class="cattext" color="0E0E0E"><b><?php echo $rows['catogory']; ?></b></font>
</td>
</tr>
<tr>
<td class="windowbg" bgcolor="EFEFEF" width="8%" align="center" valign="middle">
</td>
<td class="windowbg2" bgcolor="F6F6F6" align="left" width="66%" valign="top" style="cursor:pointer;" onClick="if(!pb_bubble)location.href='/index.cgi?board=updates';" onMouseOver="mouseOverHighlightCell(this);setWindowStatus('Upgrades / News Board');return true;"  onmouseout="mouseOutHighlightCell(this);setWindowStatus('');return true;">
<font size="2"><a href="view_board.php?board=<?php echo $rows['board']; ?>"><?php echo $rows['boardname']; ?></a></font><br/>
<font size="1"><?php echo $rows['description']; ?><br/></font>
</td>
<td class="windowbg" bgcolor="EFEFEF" valign="middle" align="center" width="1%">
<font size="2"><? echo $rows['topics']; ?></font>
</td>
<td class="windowbg" bgcolor="EFEFEF" valign="middle" align="center" width="1%">
<font size="2"><? echo $rows['posts']; ?></font>
</td>
<td class="windowbg2" bgcolor="F6F6F6" width="24%" valign="top">
<font size="1"></font>
</td>
</tr>
<?php
// Exit looping and close connection
}
mysql_close();
?>
<tr>
<td colspan="5" align="right" class="catbg" bgcolor="DADADA" height="18"><font size="2" class="cattext" color="0E0E0E">Mark All Boards As Read <a href="/index.cgi?action=markallboardsread"></a></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br/>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor">
<tr>
<td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="4080B0" class="titlebg" align="center" colspan="2">
<font class="text1" color="F1F1F1" size="2"><b>Info Center</b></font>
</td>
</tr>
<tr>
<td class="catbg" bgcolor="DADADA" colspan="2">
<font size="2" class="cattext" color="0E0E0E"><b>Forum Statistics</b></font>
</td>
</tr>
<tr>

<td class="windowbg2" bgcolor="F6F6F6" valign="top" align="center">
<table width="98%" cellpadding="3" align="center"><tr><td valign="top" align="left" width="60%">
<font size="1">Total Topics:    -   Total Posts: <br/>
Last Updated Topic: by <br/>View the <a href="/index.cgi?action=recent">10 most recent posts</a> of this forum.</font>
</td>
<td valign="top" align="left" width="40%">
<font size="1">Total Members: <a href="/index.cgi?action=members">0</a><br/>Newest Member: <br/>Your Private Messages: <a href="/index.cgi?action=pm">0</a> New: <a href="/index.cgi?action=pm">0</a></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="catbg" bgcolor="DADADA" colspan="2">
<font size="2" class="cattext" color="0E0E0E"><b>Today's Birthdays</b></font>
</td>
</tr>
<tr>

<td class="windowbg2" bgcolor="F6F6F6" valign="top">
<table width="98%" cellpadding="3" align="center">
<tr>
<td valign="top" align="left">
<font size="1"> birthdays today.<br/></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="catbg" bgcolor="DADADA" colspan="2">
<font size="2" class="cattext" color="0E0E0E"><b>Users Online</b></font>
</td>
</tr>
<tr>

<td class="windowbg2" bgcolor="F6F6F6"><table width="98%" cellpadding="3" align="center">
<tr>
<td valign="top" align="left"><font size="1">1 Staff Members, 0 Members, 0 Guests, 0 Invisible Users.
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
    </td>
  </tr>
</table>
<center></center>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.