Parse Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpnew
Forum Newbie
Posts: 18
Joined: Tue Oct 12, 2004 7:40 am

Parse Error

Post by phpnew »

Hello All

I am getting this error

Parse error: parse error, unexpected $end in c:\program files\apache group\apache\htdocs\furniture.php on line 135

I have tried to find the $ sign and any other errors made but could not.

I am sure it is a very common error must be some small mistake. Please do tell me.

Thanks
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Could you please post your code please =)
phpnew
Forum Newbie
Posts: 18
Joined: Tue Oct 12, 2004 7:40 am

Post by phpnew »

Hi Dale
Thank you for your response would you like all the code it is about 145 lines of code.

please respond
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Lines 120 - 145 please ;)

I'll request more if needed :)
phpnew
Forum Newbie
Posts: 18
Joined: Tue Oct 12, 2004 7:40 am

Post by phpnew »

Hi Dale,

I think their seems to be this small error with the { I will try and if I don't will certainly send the code.

Thanks Once Again
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

ok ;)
phpnew
Forum Newbie
Posts: 18
Joined: Tue Oct 12, 2004 7:40 am

Post by phpnew »

Hi Dale

I am getting this error now. I cannot find a solution for this problem as the same code works well with other pages.

Parse error: parse error, unexpected '/' in c:\program files\apache group\apache\htdocs\furniture.php on line 93

Code: Select all

$query .= " )";
	switch ($value) {
		case "100": $query .= "value<= 100"; break;
		case "200": $query .= "value>= 100 AND value <= 200"; break;
		case "300": $query .= "value>= 200 AND value <= 300"; break;
		case "500": $query .= "value>= 300 AND value <= 500"; break;
		case "above": $query .= "value>= 500"; break;
	} 
	if ($all_cost != "on") $query .= " AND (value='$value')";
	$query .= " ORDER By value";
	$result = db_query($query, $db_connection);
	if (mysql_num_rows($result) > 0) {
		echo "<p align="center"><a href="javascript:history.back();">Refine this search</a></p>";
		echo "<table width="100%">";
		while ($furniture = mysql_fetch_object($result)) {
			$style = ($style == "#efefef") ? "#dedede" : "#efefef";
			echo "<tr style="background-color: $style">";
			echo "<td width="200" align="center">";
			if (file_exists("pictures/property_".$property->id.".jpg")) echo "<img src="pictures/property_".$property->id.".jpg" />";
			else echo "<img src="images/no_picture.gif" width="175" height="150" />";
			echo "</td>";
			echo "<td valign="top"><table width="100%"><tr><td width="50%" valign="top"><p><b>furniture type:</b> ".ucfirst($furniture->furniture_type)."<br/><b>Material:</b> $furniture->material_type<br /><b>Value:</b> £$furniture->value."</p>";
			echo "</td><td width="50%" valign="top"><p><b>Details:</b><br/>$furniture->detail</p></td></tr></table></td>";
			echo "</tr>";
		        echo "</table>"; 
		echo "<p align="center"><a href="javascript:history.back();">Refine this search</a></p>";
	}
}
  else {
		echo "<p>There is no furniture that meet your search criteria, please <a href="javascript:history.back();">modify your search</a></p>";
	db_disconnect($db_connection);
}
}
please advice.

Weirdan | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

you have your quotes messed up at the line #93 (suggestion: look at the highlighting)
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Well the only error type thing i can see is on line 94. Where it says

Code: Select all

echo "</td><td width="50%" valign="top"><p><b>Details:</b><br/>$furniture->detail</p></td></tr></table></td>";
it should say

Code: Select all

echo "</td><td width="50%" valign="top"><p><b>Details:</b><br/>$furniture->detail</p></td></tr></table></td>";
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

Code: Select all

echo "&lt;td valign="top"&gt;&lt;table width="100%"&gt;&lt;tr&gt;&lt;td width="50%" valign="top"&gt;&lt;p&gt;&lt;b&gt;furniture type:&lt;/b&gt; ".ucfirst($furniture-&gt;furniture_type)."&lt;br/&gt;&lt;b&gt;Material:&lt;/b&gt; $furniture-&gt;material_type&lt;br /&gt;&lt;b&gt;Value:&lt;/b&gt; &amp;pound;$furniture-&gt;value."&lt;/p&gt;";
should be

Code: Select all

echo "&lt;td valign="top"&gt;&lt;table width="100%"&gt;&lt;tr&gt;&lt;td width="50%" valign="top"&gt;&lt;p&gt;&lt;b&gt;furniture type:&lt;/b&gt; ".ucfirst($furniture-&gt;furniture_type)."&lt;br/&gt;&lt;b&gt;Material:&lt;/b&gt; $furniture-&gt;material_type&lt;br /&gt;&lt;b&gt;Value:&lt;/b&gt; &amp;pound;".$furniture-&gt;value."&lt;/p&gt;";
you should also learn when to use single or double quotes, it can make coding much easier, espescially when dealing w/ html

ex:

Code: Select all

echo '&lt;td valign="top"&gt;&lt;table width="100%"&gt;&lt;tr&gt;&lt;td width="50%" valign="top"&gt;&lt;p&gt;&lt;b&gt;furniture type:&lt;/b&gt; '.ucfirst($furniture-&gt;furniture_type).'&lt;br/&gt;&lt;b&gt;Material:&lt;/b&gt; '.$furniture-&gt;material_type.'&lt;br /&gt;&lt;b&gt;Value:&lt;/b&gt; &amp;pound;'.$furniture-&gt;value.'&lt;/p&gt;';
Post Reply