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