supermerc Posted March 11, 2007 Share Posted March 11, 2007 Hey im not soo good with php and I dont know what is wrong with this code this is error im getting Parse error: syntax error, unexpected '<' in /home/randomy/public_html/welcome.php on line 6 <?php session_start(); require("config.php"); require("functions.php"); <table border="0"> <tr> <td>echo "Welcome, '.$_SESSION['s_name'].'";</td> </tr> <tr> <td>echo "You are logged in as '.$_SESSION['s_username'].'";</td> </tr> <tr> <td> </td> </tr> <tr> <td>echo "<a href="members.php">Members</a>";</td> </tr> <tr> <td>echo "<a href="inbox.php">Inbox</a>"; $message = mysql_query("SELECT COUNT(*) FROM myPMs WHERE opened != 'y' AND to_id = '{$_SESSION['s_id']}'") or die ("My SQL Error: <br />". mysql_error()); $msgs = mysql_fetch_array($message); if ($msgs['COUNT(*)'] > 0) { // News Msgs Found echo "<img src=\"images/envelope.gif\" />"; } ; </td> </tr> <tr> <td>echo "<a href="edit_profile.php">My Profile</a>";</td> </tr> <tr> <td>echo "<a href="logout.php">Logout</a>";</td> </tr> </table> ?> Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/ Share on other sites More sharing options...
jeremywesselman Posted March 11, 2007 Share Posted March 11, 2007 What kind of error message do you get? Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/#findComment-204674 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 Re read post I made an edit Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/#findComment-204675 Share on other sites More sharing options...
interpim Posted March 11, 2007 Share Posted March 11, 2007 use single quotes instead of double quotes when you are echoing html Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/#findComment-204676 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 Changed them to single and getting same error this is what i got now <?php session_start(); require("config.php"); require("functions.php"); <table border="0"> <tr> <td>echo 'Welcome, '.$_SESSION['s_name'].'';</td> </tr> <tr> <td>echo 'You are logged in as '.$_SESSION['s_username'].'';</td> </tr> <tr> <td> </td> </tr> <tr> <td>echo '<a href="members.php">Members</a>';</td> </tr> <tr> <td>echo '<a href="inbox.php">Inbox</a>'; $message = mysql_query("SELECT COUNT(*) FROM myPMs WHERE opened != 'y' AND to_id = '{$_SESSION['s_id']}'") or die ("My SQL Error: <br />". mysql_error()); $msgs = mysql_fetch_array($message); if ($msgs['COUNT(*)'] > 0) { // News Msgs Found echo "<img src=\"images/envelope.gif\" />"; } ; </td> </tr> <tr> <td>echo '<a href="edit_profile.php">My Profile</a>';</td> </tr> <tr> <td>echo '<a href="logout.php">Logout</a>';</td> </tr> </table> ?> Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/#findComment-204677 Share on other sites More sharing options...
jeremywesselman Posted March 11, 2007 Share Posted March 11, 2007 <?php session_start(); require("config.php"); require("functions.php"); ?> <table border="0"> <tr> <td>Welcome, <?php echo $_SESSION['s_name']; ?></td> </tr> <tr> <td>You are logged in as <?php echo $_SESSION['s_username']; ?></td> </tr> <tr> <td> </td> </tr> <tr> <td><a href="members.php">Members</a></td> </tr> <tr> <td><a href="inbox.php">Inbox</a> <?php $message = mysql_query("SELECT COUNT(*) FROM myPMs WHERE opened != 'y' AND to_id = '{$_SESSION['s_id']}'") or die ("My SQL Error: <br />". mysql_error()); $msgs = mysql_fetch_array($message); if ($msgs['COUNT(*)'] > 0) { // News Msgs Found echo "<img src=\"images/envelope.gif\" />"; } ?> </td> </tr> <tr> <td><a href="edit_profile.php">My Profile</a></td> </tr> <tr> <td><a href="logout.php">Logout</a></td> </tr> </table> You're hopping in and out of php and html. Here is your script fixed like it should be. If you are going to use php to echo stuff, you have to echo ALL the HTML, not just the link. Jeremy Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/#findComment-204678 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 Thanks, again lol Link to comment https://forums.phpfreaks.com/topic/42192-solved-syntax-error/#findComment-204680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.