chris_rulez001 Posted June 27, 2007 Share Posted June 27, 2007 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> Quote Link to comment Share on other sites More sharing options...
per1os Posted June 27, 2007 Share Posted June 27, 2007 Please be so kind as to point out what line is 222. Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted June 27, 2007 Author Share Posted June 27, 2007 line 222 is the last line of the code, i dont understand why its saying its a parse error, there is no variable on the last line Quote Link to comment Share on other sites More sharing options...
papaface Posted June 27, 2007 Share Posted June 27, 2007 You have missed a { or a } Look through at else's and if's Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted June 27, 2007 Author Share Posted June 27, 2007 i cant find a problem with the { or }, ive looked again and again and i still cant find the problem Quote Link to comment Share on other sites More sharing options...
papaface Posted June 27, 2007 Share Posted June 27, 2007 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. Quote Link to comment Share on other sites More sharing options...
per1os Posted June 27, 2007 Share Posted June 27, 2007 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. Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted June 27, 2007 Author Share Posted June 27, 2007 right ive changed that bit but the error is still occuring Quote Link to comment Share on other sites More sharing options...
per1os Posted June 27, 2007 Share Posted June 27, 2007 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; ?> Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted June 29, 2007 Author Share Posted June 29, 2007 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> Quote Link to comment Share on other sites More sharing options...
sushant_d84 Posted June 29, 2007 Share Posted June 29, 2007 CAN U GIVE THE " ; " for session_start() statement first then lets try again Quote Link to comment Share on other sites More sharing options...
sushant_d84 Posted June 29, 2007 Share Posted June 29, 2007 ALSO THERE IS NO CLosing paranthesis for while($rows1 = mysql_fetch_array($result1) may be near to line 45- onwards .. try this one also Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted June 29, 2007 Author Share Posted June 29, 2007 thanks for all your help everyone, it works now Quote Link to comment 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.