Forum Moderators: coopster

Message Too Old, No Replies

parse error

Parse error: parse error, unexpected $

         

hotaru

6:33 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



Hello! Well, this is probably the code that keeps driving me nuts that I have to KILL to figure out the problem. The error is:
Parse error: parse error, unexpected $ in /home/(username)/public_html/series/category.php on line 78

here is the code:


<?
include("config.php");
include("../header.inc");
?>
<table align="center" border="0" width="60%" cellpadding="0" cellspacing="0">
<tr>
<td align="left" width="100%">
<?
$query="SELECT linkID FROM $table_link";
$result=mysql_query($query);
$num_link=mysql_numrows($result);
$result=mysql_query ("SELECT name FROM $table_cat WHERE catID=$id");
if ($row=mysql_fetch_array($result)) {
do {
?>
<b><?=$row["name"]?></b>
<p>
<?
} while($row=mysql_fetch_array($result));
} else {print "<b>No such category</b>";}
?>
<p></p>
</td>
</tr>
<tr>
<td width="100%" align="center">
<?
$result=mysql_query ("SELECT * FROM $table_link WHERE relCatID=$id ORDER BY title ASC");
if ($row=mysql_fetch_array($result)) {
do {
$width=$row["width"];
$height=$row["height"];
if ($width < 10){
$insert_width = "";
} else { $insert_width=" width=\"$width\""; }
if ($height < 10){
$insert_height = "";
} else { $insert_height=" height=\"$height\""; }
?>
<p></p>
</td>
</tr>
</table>
<table border="1" width="100%" bordercolor="#000000" valign="top">
<tr>
<td width="16%" valign="top"><a href="http://site.example.com/characters/category.php?id=<?=$row["name"]?>">Character
Bios</a><br>
<a href="http://site.example.com/episodes/category.php?id=<?=$id?>">Episode Guide</a><br>
<a href="http://site.example.com/relationships/category.php?id=<?=$id?>">Relationships</a><br>
<a href="http://site.example.com/media/category.php?id=<?=$id?>">Media</a></td>
<td width="50%" valign="top"><img border="0" src="<?=$base_url?><?=$row["id"]?>" align="left"><b><?=$row["name"]?></b> <br>
<i><?=$row["description"]?></i>
</td>
</tr>
<tr>
<td width="16%" valign="top">rating</td>
<td width="50%"><? require('http://site.example.com/comments/inc_rate.php');
getComments("1");
submitComments("1","$PHP_SELF");?>
</td>
</tr>
</table>
« <a href="javascript:history.back()">back</a><? include("home/username/public_html/series/footer.inc");?>

The error is comming from the very last line, and I can not find anything wrong with it. Please help!

[edited by: jatar_k at 6:39 pm (utc) on June 29, 2005]
[edit reason] generalized url [/edit]

dreamcatcher

6:36 pm on Jun 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World hotaru.

Last line errors are pretty much always missing braces. Check your code to see if all your braces are opened and closed correctly.

dc

jatar_k

6:37 pm on Jun 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld hotaru,

do {

this seems to be opened but I don't see a matching closing brace

<added>I lied ;) still looking

<added2>ok maybe the second do {

hotaru

6:46 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



question: where would i put the braces ^_^;;

jatar_k

6:49 pm on Jun 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



actually another question

if ($row=mysql_fetch_array($result)) {
do {

that doesn't quite make sense to me, are there multiple results? I assume there are, I would change those 2 lines to this one

while ($row=mysql_fetch_array($result)) {

then close it after whatever code is used for that loop

hotaru

10:11 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



Thank you all very much for your help. After looking though the script, I was able to find out the problem on my own ^_^;;; I'm very sorry. But thank you all for the help

jatar_k

2:52 am on Jul 1, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



glad you found it hotaru