Page 1 of 1

Parse Error

Posted: Mon Nov 08, 2004 12:36 pm
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

Posted: Mon Nov 08, 2004 12:42 pm
by Dale
Could you please post your code please =)

Posted: Mon Nov 08, 2004 12:52 pm
by phpnew
Hi Dale
Thank you for your response would you like all the code it is about 145 lines of code.

please respond

Posted: Mon Nov 08, 2004 12:54 pm
by Dale
Lines 120 - 145 please ;)

I'll request more if needed :)

Posted: Mon Nov 08, 2004 1:23 pm
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

Posted: Mon Nov 08, 2004 1:23 pm
by Dale
ok ;)

Posted: Tue Nov 09, 2004 9:55 am
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]

Posted: Tue Nov 09, 2004 10:15 am
by Weirdan
you have your quotes messed up at the line #93 (suggestion: look at the highlighting)

Posted: Tue Nov 09, 2004 2:09 pm
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>";

Posted: Tue Nov 09, 2004 2:18 pm
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;';