Forum Moderators: coopster

Message Too Old, No Replies

Parse Error using PHP and MySQL

Error received when trying to return search results from db using PHP

         

alexmnicholas

2:29 pm on Feb 23, 2006 (gmt 0)

10+ Year Member



Hi. I am getting the following error when trying return search results from a mySQL database and post of my site using PHP:

Parse error: parse error, unexpected '=', expecting ',' or ')' in /home/uaeletti/public_html/results.php on line 14
.

The code is below. Could anyone please assist?
Many thanks,
Alex.

<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Prop_Search = 10;
$pageNum_Prop_Search = 0;
if (isset($_GET['pageNum_Prop_Search'])) {
$pageNum_Prop_Search = $_GET['pageNum_Prop_Search'];
}
$startRow_Prop_Search = $pageNum_Prop_Search * $maxRows_Prop_Search;

$location_Prop_Search = "%";
if (isset(#location#)) {
$location_Prop_Search = (get_magic_quotes_gpc())? #location# : addslashes(#location#);
}
$emirate_Prop_Search = "%";
if (isset(#emirate#)) {
$emirate_Prop_Search = (get_magic_quotes_gpc())? #emirate# : addslashes(#emirate#);
}
$lengthofstay_Prop_Search = "%";
if (isset(#lengthofstay#)) {
$lengthofstay_Prop_Search = (get_magic_quotes_gpc())? #lengthofstay# : addslashes(#lengthofstay#);
}
$furnishing_Prop_Search = "%";
if (isset(#furnishing#)) {
$furnishing_Prop_Search = (get_magic_quotes_gpc())? #furnishing# : addslashes(#furnishing#);
}
$noofbeds_Prop_Search = "%";
if (isset(#noofbeds#)) {
$noofbeds_Prop_Search = (get_magic_quotes_gpc())? #noofbeds# : addslashes(#noofbeds#);
}
?>

[edited by: coopster at 5:55 pm (utc) on Feb. 23, 2006]
[edit reason] removed unnecessary code [/edit]

omoutop

2:58 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try not to use #var#...
# is comment symbol

insted use 'var' OR "var"

so you rcode might look like :


if (isset('location')) {
$location_Prop_Search = (get_magic_quotes_gpc())? 'location' : addslashes('location');

if (location) is a var


if (isset($location)) {
$location_Prop_Search = (get_magic_quotes_gpc())? $location : addslashes($location);

I think this might be the reason... give it a try and see what will happen

alexmnicholas

4:03 pm on Feb 23, 2006 (gmt 0)

10+ Year Member



Thanks for the suggestion. I tried changing the run-time value to'location' instead of #location#, but that returns a slightly different error message:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_VARIABLE or '$' in /home/uaeletti/public_html/results.php on line 13

Any further ideas?

Your help is much appreciated!

coopster

5:54 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, alexmnicholas.

Actually, variable names start with a dollar sign. You got your first edit check correct on the 'pageNum_Prop_Search' index of the $_GET superglobal, but then you went off track with the rest. You need to alter all those after the first one to look like the first one, assuming the 'location' variable and others are part of the QUERY_STRING.