Page 1 of 1

syntax error, unexpected $end

Posted: Sat Oct 22, 2005 6:31 am
by rsasalm
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hi all,
I am new to PHP and this forum and hope someone can help me.
I have a very simple script as below and when I run this I get the following error:
[b]
Parse error: syntax error, unexpected $end in c:\wamp\www\test\index.php on line 59[/b]
Line 59 is a blank line.

Code: Select all

<?php
include("config.inc.php"); // here I connect to database and it works fine


$result = mysql_query( "SELECT category_id,category_name FROM gallery_category" );
while( $row = mysql_fetch_array( $result ) )
{
$photo_category_list .=<<<__HTML_END
<option
value="$row[0]">$row[1]</option>\n
__HTML_END;
}


mysql_free_result( $result );

// Final Output
echo <<<__HTML_END

<html>
<head>
<title>Gallery View</title>
</head>
<body>
<form enctype='multipart/form-data' action='index.php' method='post' name='upload_form'>
<table width='100%' border='0' align='center' style='width: 100%;'>


<tr>
<td>
Select Product Category:
</td>
</tr>

<tr>
<td>
<select name='category'>
$photo_category_list
</select>
</td>
</tr>
<tr>
<td >
<input type='submit' VALUE="GO" />
</td>
</tr>


</table>
</form>

</body>
</html>

__HTML_END;
?>
I even searched for the answer on the internet and most of time the only answer I found is the some
closing braces are missing.
But as my code is very simple I don't see any such misstake.
Can someone see in my code that what else I am missing.
thanks for help
regards
/rsasalm


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Sat Oct 22, 2005 8:50 am
by feyd
do not place code immediately after the heredoc end markers.