Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Parse error: syntax error, unexpected T_VARIABLE


mysticgifts

Recommended Posts

Hi,

 

I am new to all of this, and no nothing about html. I have learned enough to change colors and such. I was attempting to make such a change and ended up with the following message:

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/mysti43/public_html/forum.php on line 367

 

Can't figure out what I messed up. Can anyone please help? Here's the code for the fourm.php

 

Thanks so much!!!!

 

<?php

 

/*

 

$Id:CMS ZNEAK v.02

 

osCommerce, Open Source E-Commerce Solutions

 

http://www.oscommerce.com

 

 

 

Copyright © 2002 osCommerce

 

 

 

Released under the GNU General Public License

 

*/

 

 

 

require('includes/application_top.php');

 

$breadcrumb->add(Forum, tep_href_link('forum.php', '', 'NONSSL'));

 

?>

 

 

 

 

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

 

<html <?php echo HTML_PARAMS; ?>>

 

<HEAD>

 

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

<?php

 

// Header Tag Controller v1.0

 

// Replaced by header_tags.php

 

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

 

require(DIR_WS_INCLUDES . 'header_tags.php');

 

} else {

 

?>

 

<title><?php echo TITLE ?></title>

 

<?php

 

}

 

// EOF: Header Tag Controller v1.0

 

?>

 

<META NAME="Author" CONTENT="www.lxfx.com">

 

<meta name="robots" content="index, follow">

 

<meta name="revisit-after" content="7 days">

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

 

<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

</head>

 

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

 

<!-- header //-->

 

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

 

<!-- header_eof //-->

 

 

 

<!-- body //-->

 

<?php print($test); ?>

 

<table border="0" width="100%" cellspacing="3" cellpadding="3">

 

<tr>

 

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

 

<!-- left_navigation //-->

 

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

 

<!-- left_navigation_eof //-->

 

</table></td>

 

<!-- body_text //-->

 

<td width="100%" valign="top">

 

<table width="100%" cellspacing="0" cellpadding="2">

 

<tr>

 

<td valign="top">

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

 

<tr>

 

<td height="14" class="infoBoxHeading" width="100%">    Forum</td>

 

</tr>

 

</table>

 

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

 

<tr>

 

<td align="center">

 

<table border="0" width="100%" cellspacing="0" cellpadding="4" class="infoBoxContents">

 

<tr>

 

<td>  </td>

 

<td><br><br>

 

 

 

 

 

 

 

<?php

 

 

 

 

 

 

 

include("forum_config.php");

 

include("forum_lib.php");

 

?>

 

 

 

<center>

 

<table border="0" cellpadding="0" cellspacing="0" width="<?php echo $tablewidth; ?>">

 

<tr><td align="center">

 

<font face="<?php echo $default_font ?>" size="5" color="<?php echo $headlines ?>"><b><?php echo $forum_title; ?></b></font><br>

 

<br><br>

 

<table width="100%" border="0" cellspacing="0" cellpadding="0">

 

<tr>

 

<td>

 

<table width="150" border="0" cellspacing="0" cellpadding="1" bgcolor="#003399">

 

<tr>

 

<td>

 

<table width="100%" border="0" cellspacing="0" bgcolor="<?php echo $buttons ?>" cellpadding="3">

 

<tr>

 

<td align="center">

 

<b><font face="<?php echo $default_font ?>" size="2">

 

<a href="forum_newtopic.php">

 

<font color="#FFFFFF" style="text-decoration:none;">New Topic</font>

 

</a></font></b></td>

 

</tr>

 

</table>

 

</td>

 

</tr>

 

</table>

 

 

 

<?php

 

 

 

$hasil = mysql_query("SELECT * FROM forum_post");

 

$total_post = mysql_num_rows($hasil) or die("No posting records found!");

 

 

 

$hasil_topic = mysql_query("SELECT * FROM forum_topic");

 

$total_topic = mysql_num_rows($hasil_topic) or die("No topic records found!");

 

 

 

?>

 

</td>

 

<td align="right"><font face="<?php echo $default_font ?>" size="1"><b>

 

<font color="<?php echo $headlines ?>">Topic : </font><?php echo $total_topic; ?> --

 

<font color="<?php echo $headlines ?>">Posting : </font><?php echo $total_post; ?> -- <font color="<?php echo $headlines ?>">

 

 

 

<?php

 

 

 

$query = mysql_query("SELECT * FROM forum_topic ORDER BY topic_last_post_id ASC");

 

$all_record = mysql_num_rows($query) or die("No topic records found!");

 

if ($page == "") $page = 1;

 

 

 

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

if ($all_record <= $itemperpage) {$pagenumber = 1;} else

 

{

 

if (($all_record % $itemperpage) == 0) {$pagenumber = intval($all_record/$itemperpage);} else

 

{$pagenumber = intval($all_record/$itemperpage) + 1;}

 

}

 

 

 

if ($pagenumber == 1) {

 

$start = 1;

 

$end = $all_record;

 

$looping = $all_record; } else {

 

 

 

if (($all_record % $itemperpage) == 0) {

 

$sisa = $itemperpage;

 

} else {

 

$sisa = $all_record % $itemperpage; }

 

 

 

if ($page == $pagenumber) {

 

 

 

$start = 1;

 

$end = $sisa;

 

$looping = $sisa; } else {

 

 

 

$end = (($pagenumber - $page) * $itemperpage) + $sisa;

 

$start = $end - $itemperpage + 1;

 

$looping = $itemperpage;}

 

}

 

 

 

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

 

 

$url = "forum.php?";

 

navigation($pagenumber, $page, $url);

 

 

 

?>

 

 

 

</font></b></font></td>

 

</tr>

 

</table>

 

<img height="4" src="images/space.gif" width=600><br>

 

<table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999">

 

<tr>

 

<td width="20%" bgcolor="<?php echo $topbar ?>"><font size="1" face="<?php echo $default_font ?>" color="#FFFFFF"><b>Posted</b></font></td>

 

<td width="50%" bgcolor="<?php echo $topbar ?>"><font size="1" face="<?php echo $default_font ?>" color="#FFFFFF"><b>Topic</b></font></td>

 

<td width="5%" bgcolor="<?php echo $topbar ?>"><font size="1" face="<?php echo $default_font ?>" color="#FFFFFF"><b>Views</b></font></td>

 

<td width="5%" bgcolor="<?php echo $topbar ?>"><font size="1" face="<?php echo $default_font ?>" color="#FFFFFF"><b>Replies</b></font></td>

 

<td width="20%" bgcolor="<?php echo $topbar ?>" align="center"><font size="1" face="<?php echo $default_font ?>" color="#FFFFFF"><b>Last Reply</b></font></td>

 

</tr>

 

 

 

<?php

 

 

 

for ($i=1; $i<=$looping; $i++) {

 

$counter = $end - $i;

 

$seekrecord = mysql_data_seek($query, $counter);

 

$data = mysql_fetch_row($query) or die("No records found!");

 

$nomor = $counter + 1;

 

 

 

if ((($i+1) % 2) == 0) $kolor = $color1; else $kolor = $color2;

 

$tgl = substr($data[3],8,2) . "-" . substr($data[3],5,2) . "-" . substr($data[3],0,4);

 

 

 

echo "<tr bgcolor="$kolor">";

 

echo "<td valign="top"><font face="$default_font" size="1">$tgl<br>";

 

 

 

$hasil_user = mysql_query("SELECT * FROM forum_post WHERE topic_id=$data[0] ORDER BY post_time ASC");

 

$data_user = mysql_fetch_row($hasil_user) or die("No records found!");

 

$user = $data_user[2];

 

$user_mail = $data_user[4];

 

$user_web = $data_user[5];

 

 

 

echo "by <b>$user</b></font><font face="$default_font"><br>";

 

if (!$user_mail == "") echo "<a href="mailto:$user_mail"><img src="images/sym_email.gif" width="33" height="17" border="0"></a> ";

 

if (!$user_web == "") echo "<a href="$user_web" target="_blank"><img src="images/sym_www.gif" width="34" height="17" border="0"></a>";

 

 

 

echo "</font></td>";

 

 

 

echo "<td><font face="$default_font" size="1"><a href="forum_viewtopic.php?id=$data[0]"><b>$data[1]</b></a><br>";

 

 

 

$hasil_post = mysql_query("SELECT * FROM forum_post WHERE topic_id=$data[0] ORDER BY post_time ASC");

 

$data_post = mysql_fetch_row($hasil_post) or die("No records found!");

 

$hasil_text = mysql_query("SELECT * FROM forum_postext WHERE post_id=$data_post[0]");

 

$data_text = mysql_fetch_row($hasil_text) or die("No records found!");

 

 

 

$hasil_last = mysql_query("SELECT * FROM forum_post WHERE post_id=$data[6]");

 

$data_last = mysql_fetch_row($hasil_last) or die("No records found!");

 

 

 

$tgl_last = substr($data_last[3],8,2) . "-" . substr($data_last[3],5,2) . "-" . substr($data_last[3],0,4);

 

 

 

echo $data_text[1] . "</font></td>";

 

 

 

echo "<td align="center"><b><font size="2" face="$default_font">$data[4]</font></b></td>

 

<td align="center"><b><font size="2" face="$default_font" color="$headlines">$data[5]</font></b></td>

 

<td align="center"><font face="$default_font" size="1">$tgl_last<br>";

 

 

 

$hasil_last_user = mysql_query("SELECT * FROM forum_post WHERE topic_id=$data[0] ORDER BY post_time DESC");

 

$data_last_user = mysql_fetch_row($hasil_last_user) or die("No records found!");

 

$last = $data_last_user[2];

 

 

 

echo "by <b>$last</b></font></td></tr>";

 

 

 

}

 

 

 

?>

 

 

 

</table>

 

<br>

 

<div align="left">

 

<table width="150" border="0" cellspacing="0" cellpadding="1" bgcolor="#003399">

 

<tr>

 

<td>

 

<table width="100%" border="0" cellspacing="0" bgcolor="<?php echo $buttons ?>" cellpadding="3">

 

<tr>

 

<td align="center">

 

<b><font face="<?php echo $default_font ?>" size="2">

 

<a href="forum_admin.php">

 

<font color="#FFFFFF" style="text-decoration:none;">Admin</font>

 

</a></font></b></td>

 

</tr>

 

</table>

 

</td>

 

</tr>

 

</table>

 

</div>

 

</td></tr>

 

</table>

 

 

 

 

 

<br><br></td>

 

<td>  </td>

 

</tr>

 

</table>

 

</td>

 

 

 

</tr>

 

</table>

 

</td>

 

</tr>

 

</table>

 

</td>

 

<!-- body_text_eof //-->

 

<td valign="top"></td>

 

</tr>

 

</table>

 

<!-- body_eof //-->

 

 

 

<!-- footer //-->

 

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

 

<!-- footer_eof //-->

 

<br>

 

</body>

 

</html>

 

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Lines 367 and 369

 

echo "<tr bgcolor="$kolor">";

echo "<td valign="top"><font face="$default_font" size="1">$tgl<br>";

 

try this

 

echo "<tr bgcolor=" . $kolor . ">";

echo "<td valign=\"top\"><font face=" . $default_font . " size=\"1\">" . $tgl . "<br>";

Link to comment
Share on other sites

Lines 367 and 369

 

echo "<tr bgcolor="$kolor">";

echo "<td valign="top"><font face="$default_font" size="1">$tgl<br>";

 

try this

 

echo "<tr bgcolor=" . $kolor . ">";

echo "<td valign=\"top\"><font face=" . $default_font . " size=\"1\">" . $tgl . "<br>";

 

I tried that, but now it's saying:

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/mysti43/public_html/forum.php on line 384

 

PLEASE HELP!!!

Link to comment
Share on other sites

I tried that, but now it's saying:

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/mysti43/public_html/forum.php on line 384

 

PLEASE HELP!!!

looking at it you need to move your quotes, I think this should work

 

The message is tellin you that it is expecting a comma or a semi colon and you have something else where they shoud be. Look at the coding on the original lines. do you have a copy of the original file you can check against?

Also you could use one of the existing TR and TD tags to replace it just to check!

Link to comment
Share on other sites

looking at it you need to move your quotes, I think this should work

 

The message is tellin you that it is expecting a comma or a semi colon and you have something else where they shoud be. Look at the coding on the original lines. do you have a copy of the original file you can check against?

Also you could use one of the existing TR and TD tags to replace it just to check!

 

 

No, that's the problem. I didn't do a backup right before I made my changes. Opps! I'm sorry, but I don't know what you mean by using on of the existing TR or TD Tags? Thanks for your patience!!!

Link to comment
Share on other sites

I didn't look through the whole file, just the line of the original error plus I noticed the next one. The fact the error line has dropped down, shows you have more errors similar to the first.

 

Line 384

 

echo "by <b>$user</b></font><font face="$default_font"><br>";

 

try this

 

echo "by <b>" . $user . "</b></font><font face=" . $default_font . "><br>";

 

When you echo a string, it is surrounded by quotation marks "" i.e. "by <b>"

You don't need the quotes to echo a variable, such as $user but when you want the variable included with the string, you need to use a concatenate operator (full stop) either side, to add it (concatenate) to the string. If the variable is to be added inside a string, you have to end it, add the variable and start it again, with the quotes.

i.e. (begin string)"by <b>"(end string) (concatenate variable). $user .(concatenate string) (begin string)"</b></font><font face="(end string)

If you want to use quotes within the string, you need to use the escape character (backslash \) to tell the PHP parser, I don't want to end the string here, I want you to echo the quotation mark. i.e. "<table width=\"50%\" border=\"1\"><tr><td>"

You can use single quotes to signify the string and double quotes inside the string without escaping them but I wasn't sure if it would screw the rest of it up so that is why I escaped them before.

 

When you have fixed Line 384, the error will probably drop to another line. Try to look at the next error line and see if you can fix it.

Link to comment
Share on other sites

No, that's the problem. I didn't do a backup right before I made my changes. Opps! I'm sorry, but I don't know what you mean by using on of the existing TR or TD Tags? Thanks for your patience!!!

Dont worry we all make mistakes..as long as we learn from them?

 

If you rem out the two lines that are causing problems and copy and paste intwo similar ones that you havent changed. or look at two that you have not changed and follow the example/compare of where to put commas slashes etc.

Link to comment
Share on other sites

Dont worry we all make mistakes..as long as we learn from them?

 

If you rem out the two lines that are causing problems and copy and paste intwo similar ones that you havent changed. or look at two that you have not changed and follow the example/compare of where to put commas slashes etc.

 

I'm sorry, but I'm totally confused. So, I tried to do a database backup restore, and nothing changes except the counter on the bottom of my site. Maybe someone can help me do a restore?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...