Jump to content

[SOLVED] syntax error


supermerc

Recommended Posts

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

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

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

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.