Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-08-2004, 07:49 PM   PM User | #1
g0liatH
New Coder

 
Join Date: Aug 2003
Location: Belgium
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
g0liatH is an unknown quantity at this point
parse error: unexpected $

Hi,

I have a code and I can't seem to find the parse error

can someone help me please?

this is the error:

Parse error: parse error, unexpected $ in /home/virtual/site51/fst/var/www/html/td/mainnew/header.php on line 253

line 253 is the last line of the script so

here's the script

header.php

PHP Code:
<?
define
('IN_PHPBB'true); 

$site_root_path '/home/virtual/site51/fst/var/www/html/';
$phpbb_root_path2 '/forum/';
$phpbb_root_path $site_root_path $phpbb_root_path2;
include(
$phpbb_root_path 'extension.inc'); 
include(
$phpbb_root_path 'common.php'); 

$userdata session_pagestart($user_ipPAGE_INDEX); 
init_userprefs($userdata);
?>
<?
if($userdata['session_logged_in']){ //logged in

if ( $userdata['user_new_privmsg'] ) //private messages by AJ Quick
{
$l_message_new = ( $userdata['user_new_privmsg'] == ) ? $lang['New_pm'] : $lang['New_pms']; 
$l_privmsgs_text sprintf($l_message_new$userdata['user_new_privmsg']); 

if ( 
$userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql "UPDATE " USERS_TABLE "
SET user_last_privmsg = " 
$userdata['user_lastvisit'] . 
WHERE user_id = " 
$userdata['user_id'];
if ( !
$db->sql_query($sql) )
{
message_die(GENERAL_ERROR'Could not update private message new/read time for user'''__LINE____FILE__$sql);
}

$s_privmsg_new 1;
$icon_pm $images['pm_new_msg'];
}
else
{
$s_privmsg_new 0;
$icon_pm $images['pm_no_new_msg'];
}

}
else
{
$l_privmsgs_text $lang['No_new_pm'];

$s_privmsg_new 0;
$icon_pm $images['pm_no_new_msg'];
}

if ( 
$userdata['user_unread_privmsg'] )
{
$l_message_unread = ( $userdata['user_unread_privmsg'] == ) ? $lang['Unread_pm'] : $lang['Unread_pms']; 
$l_privmsgs_text_unread sprintf($l_message_unread$userdata['user_unread_privmsg']); 
}
else
{
$l_privmsgs_text_unread $lang['No_unread_pm'];
}

// if user logged in
?>

<HTML>
<HEAD>
{META}
{NAV_LINKS}
<TITLE>Tomorrows Designers :: <? echo("$title"?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript" src="alljava.js">
</script>
<?php
if ( !empty($userdata['user_popup_pm']) ){
?>
<script language="Javascript" type="text/javascript">
<!--
if (<?php echo $s_privmsg_new ?>)
{
window.open('<?php echo $phpbb_root_path2 ."privmsg.".$phpEx."?mode=newpm" ?>', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');;
}
//-->
</script>
<?php
}
?>
</HEAD>
<LINK REL="STYLESHEET" type="text/css" href="td.css">
<?
if($what == 'Forum') { echo'
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">'
; }
else { echo
'
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>'
; }
?>
<table height="100%" width=100% border=0 cellpadding=0 cellspacing=0>
  <tr> 
    <td height="134" colspan="9"> <table border=0 cellpadding=0 cellspacing=0>
        <tr> 
          <td width="134"> <img src="images/tdlogo.png" width=134 height=102 alt=""></td>
          <td colspan="12" background="images/vertup.png">&nbsp; </td>
        </tr>
        <tr> 
          <td background="images/vertmid.png"></td>
          <td width="63"> <img onMouseOver="" src="images/home.png" width=63 height=32 

alt=""></td>
          <td width="91"> <img src="images/about.png" width=91 height=32 alt=""></td>
          <td width="101"> <img src="images/forums.png" width=101 height=32 alt=""></td>
          <td width="83"> <img src="images/faq.png" width=83 height=32 alt=""></td>
          <td width="127"> <img src="images/contact.png" width=127 height=32 alt=""></td>
          <td width="117"> <img src="images/downloads.png" width=117 height=32 alt=""></td>
          <td width="75"> <img src="images/extra.png" width=75 height=32 alt=""></td>
          <td width="228" background="images/vertmid.png">&nbsp; </td>
        </tr>
      </table></td>
  <tr> 
    <td width="225" valign="top"> <br> <br> 
    <table width="198" border="0" align="center" cellpadding="0" cellspacing="0" 

background="images/navmid.png">
      <tr> 
        <td height="20" valign="bottom" background="images/navup.png"><div 

align="center">Menu</div></td>
      </tr>
      <tr> 
        <td><div align="center"><br>
          </div></td>
      </tr>
      <tr> 
        <td><div align="center"><a href="testtd.php">Home</a></div></td>
      </tr>
      <tr> 
        <td><div align="center"><a href="abouttd.php">About us</a></div></td>
      </tr>
      <tr> 
        <td><div align="center">Forums</div></td>
      </tr>
      <tr> 
        <td><div align="center">FAQ</div></td>
      </tr>
      <tr> 
        <td><div align="center">Contact us</div></td>
      </tr>
      <tr> 
        <td><div align="center"></div>
          <div align="center"><a href="extratd.php">Extra</a></div></td>
      </tr>
      <tr>
        <td><div align="center"><a href="<?php echo $phpbb_root_path2 ?>privmsg.php?folder=inbox"><?php echo $l_privmsgs_text ?></a></div></td>
      </tr>
      <tr> 
        <td height="20" background="images/navdown.png"><div align="center"></div></td>
      </tr>
    </table>
      <br> <br> 
   <? if($what !== 'post' or 'Forum') { echo '
    <table width="198" border="0" align="center" cellpadding="0" cellspacing="0" 

background="images/navmid.png">
      <tr> 
        <td height="20" valign="bottom" background="images/navup.png"><div 

align="center">'
; echo "Latest $what"; echo '</div></td>
      </tr>
      <tr> 
        <td><div align="center"><br>
          </div></td>
      </tr>
      <tr> 
        <td><div align="center"> </div>
          <div align="center">'
;
          
           include(
'db.php');

$q mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT 5"); 
// That queries the database



while($r=mysql_fetch_array($q)){

$title $r["title"];

$news $r["news"];

$body nl2br($news);

$author $r["author"];

$link "mailto:".$r["email"];

$date $r["date"];

echo 
"$title<br>";

}
mysql_close($cnx);

echo 
'</div>
          <div align="center"></div></td>
      </tr>
      <tr> 
        <td height="20" background="images/navdown.png"><div align="center"></div></td>
      </tr>
    </table>'

    
?>
    <br><br>
    <? if($what == 'Forum') { echo '
<table width="198" border="0" align="center" cellpadding="0" cellspacing="0" 

background="images/navmid.png">
      <tr> 
        <td height="20" valign="bottom" background="images/navup.png"><div 

align="center">Forum</div></td>
      </tr>
      <tr> 
        <td><div align="center"><br>
          </div></td>
      </tr>
      <tr> 
        <td><div align="center"><a href="index.php">Index</a></div></td>
      </tr>
      <tr> 
        <td><div align="center"><span class="mainmenu"><a href="{U_MEMBERLIST}" class="mainmenu">{L_MEMBERLIST}</a></span></div></td>
      </tr>
      <tr> 
        <td><div align="center"><span class="mainmenu"><a href="{U_REGISTER}" class="mainmenu">{L_REGISTER}</a></span></div></td>
      </tr>
      <tr> 
        <td><div align="center"><span class="mainmenu"><a href="{U_PROFILE}" class="mainmenu">{L_PROFILE}</a></span></div></td>
      </tr>
      <tr> 
        <td><div align="center"><span class="mainmenu"><a href="{U_SEARCH}" class="mainmenu">{L_SEARCH}</a></span></div></td>
      </tr>
      <tr> 
        <td><div align="center"></div>
          <div align="center" class="mainmenu"><a href="{U_FAQ}" class="mainmenu">{L_FAQ}</a></div></td>
      </tr>
      <tr>
        <td><div align="center"><span class="mainmenu"><a href="{U_GROUP_CP}" class="mainmenu">{L_USERGROUPS}</a></span></div></td>
      </tr>
      <tr>
        <td><div align="center"><span class="mainmenu"><a href="{U_PRIVATEMSGS}" class="mainmenu">{PRIVATE_MESSAGE_INFO}</a></span></div></td>
      </tr>
      <tr>
        <td><div align="center"><span class="mainmenu"><a href="{U_LOGIN_LOGOUT}" class="mainmenu">{L_LOGIN_LOGOUT}</a></span></div></td>
      </tr>
      <tr> 
        <td height="20" background="images/navdown.png"><div align="center"></div></td>
      </tr>
    </table>'
; }
    
?>    
    </td>
thanks
__________________
g0liatH
g0liatH is offline   Reply With Quote
Old 10-08-2004, 08:14 PM   PM User | #2
Hawkmoon
Regular Coder

 
Join Date: Apr 2004
Location: Los Angeles
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Hawkmoon is an unknown quantity at this point
Hey Goliath,

That's a lot of code to look over. If you narrow it down it would be a ton easier to find the problem. A good trick for trouble shooting is to start at the top of your code and comment EVERYTHING out. Then go step by step and UNCOMMENT small sections of your code at a time to isolate where the error is being produced. Like so:
PHP Code:
<?
/*
function doSomething() {
  return "Inside Do Something";
}
echo(doSomething());
echo("This line will cause an error<br>")
echo("This line is fine");
*/
?>
Then go section by section:
PHP Code:
<?
function doSomething() {
  return 
"Inside Do Something";
}
echo(
doSomething());
/*
echo("This line will cause an error<br>")
echo("This line is fine");
*/

//*NOTE:This will return good code, but if you uncomment the next line you'll get an error.
?>
Hawkmoon is offline   Reply With Quote
Old 10-08-2004, 08:18 PM   PM User | #3
g0liatH
New Coder

 
Join Date: Aug 2003
Location: Belgium
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
g0liatH is an unknown quantity at this point
thanks Hawkmoon. Didn't think of that, I will try it right now
__________________
g0liatH
g0liatH is offline   Reply With Quote
Old 10-08-2004, 08:22 PM   PM User | #4
Hawkmoon
Regular Coder

 
Join Date: Apr 2004
Location: Los Angeles
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Hawkmoon is an unknown quantity at this point
Cool. Let me know how it goes. If you can isolate the error and are still having problems, post the code and I'll take a look.
Hawkmoon is offline   Reply With Quote
Old 10-08-2004, 08:27 PM   PM User | #5
g0liatH
New Coder

 
Join Date: Aug 2003
Location: Belgium
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
g0liatH is an unknown quantity at this point
Great tip, thanks!

I found the code but I'm still a beginner at php

PHP Code:
  if($what !== 'post' or $what !== 'Forum') { echo '
    <table width="198" border="0" align="center" cellpadding="0" cellspacing="0" 

background="images/navmid.png">
      <tr> 
        <td height="20" valign="bottom" background="images/navup.png"><div 

align="center">'
; echo "Latest $what"; echo '</div></td>
      </tr>
      <tr> 
        <td><div align="center"><br>
          </div></td>
      </tr>
      <tr> 
        <td><div align="center"> </div>
          <div align="center">'
;
          
           include(
'db.php');

$q mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT 5"); 
// That queries the database



while($r=mysql_fetch_array($q)){

$title $r["title"];

$news $r["news"];

$body nl2br($news);

$author $r["author"];

$link "mailto:".$r["email"];

$date $r["date"];

echo 
"$title<br>";

}
mysql_close($cnx);

echo 
'</div>
          <div align="center"></div></td>
      </tr>
      <tr> 
        <td height="20" background="images/navdown.png"><div align="center"></div></td>
      </tr>
    </table>'


    
?>
    <br><br> 
It probably has something to do with the 'or' eh?

the sql code works, I tested that before so it can't be that.
__________________
g0liatH
g0liatH is offline   Reply With Quote
Old 10-08-2004, 08:31 PM   PM User | #6
Hawkmoon
Regular Coder

 
Join Date: Apr 2004
Location: Los Angeles
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Hawkmoon is an unknown quantity at this point
The "or" is ok...but you're right about the problem is with your if() section.
This should work:
PHP Code:
<?
if($what != 'post' OR $what != 'Forum') {
  echo 
'<table width="198" border="0" align="center" cellpadding="0" cellspacing="0" background="images/navmid.png"> 
      <tr> 
        <td height="20" valign="bottom" background="images/navup.png"><div align="center">'
;
  echo 
"Latest $what";
  echo 
'</div></td> 
      </tr> 
      <tr> 
        <td><div align="center"><br> 
          </div></td> 
      </tr> 
      <tr> 
        <td><div align="center"> </div> 
          <div align="center">'
;
}
//*NOTE- IMPORTANT! You need the closing bracket for your if statement
?>

Last edited by Hawkmoon; 10-08-2004 at 08:35 PM..
Hawkmoon is offline   Reply With Quote
Old 10-08-2004, 08:41 PM   PM User | #7
g0liatH
New Coder

 
Join Date: Aug 2003
Location: Belgium
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
g0liatH is an unknown quantity at this point
thanks, it works now. I added the closing bracket
__________________
g0liatH
g0liatH is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:14 AM.


Advertisement
Log in to turn off these ads.