Jump to content


Photo

Parse error: syntax error, unexpected T_ECHO in /home/u2/kabbash615/html/ineedblank/Search_Results.php on line 219


  • Please log in to reply
8 replies to this topic

#1 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 06 May 2006 - 09:09 PM

This code:

<html>
<head>
<title>Search Results!</title>
<?php
require_once('system_errors.php');
require_once('dbconnect.php');
?>
</head>

<body>
<h1>Search Results</h1>
<?php
$search_term = $_POST['search_term'];
$lowend_price = $_POST['lowend_price'];
$highend_price = $_POST['highend_price'];
$city = $_POST['city'];
$state = $_POST['state'];
$look_in = $_POST['look_in'];

$query = "select * from ".$look_in."";

if ($look_in == "General_Needs")
{
    $look_again = "General";
    }
else if ($look_in == "Cars_Needs")
{
    $look_again = "Cars";
    }
else if ($look_in == "Housing_Needs")
{
    $look_again = "Home";
    }

if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && $lowend_price && $city && $state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price 
    <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'";
}


else if ($look_in == "".$look_again."_Needs" && $search_term && !$lowend_price && !$highend_price && !$city && !$state)
{
    $query .= " where ".$look_again."_Title like '%".$search_term."%'";
}


else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && !$highend_price && !$city && !$state)
{
    $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price = '".$lowend_price."'";
    }


else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && !$city && !$state)
{
    $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and 
    ".$look_again."_Title like '%".$search_term."%'";
    }


else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && $city && !$state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."'";
    }
        
else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && !$highend_price && !$city && !$state)
{
    $query .= "where ".$look_again."_Price = '".$lowend_price."'";
    }
    
else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && $highend_price && !$city && !$state)
{
        $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && $highend_price && $city && !$state)
{
        $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_City like '%".$city."%'";
        }
        
        
else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && $highend_price && $city && $state)
{
        $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."'";
        }
    
else if ($look_in == "".$look_again."_Needs" && !$search_term && !$lowend_price && $highend_price && !$city && !$state)
{
    $query .= " where ".$look_again."_Price = '".$highend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && !$lowend_price && $highend_price && !$city && !$state)
{
        $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price = '".$highend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && !$city && !$state)
{
        $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Price >= '".$lowend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && $city && !$state)
{
        $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_City like '%".$city."%'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && !$lowend_price && !$highend_price && $city && !$state)
{
        $query .= " where ".$look_again."_City like '%".$city."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && !$lowend_price && !$highend_price && $city && !$state)
{
        $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_City like '%".$city."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && !$highend_price && $city && !$state)
{
        $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price = '".$lowend_price."' and ".$look_again."_City like '%".$city."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && $lowend_price && $city && !$state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price 
    <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && !$lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && !$highend_price && !$lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Title like '%".$search_term."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && !$lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price 
    = '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && $lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price 
    <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && !$lowend_price && $city && $state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && $highend_price && $lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price 
    <= '".$highend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && !$lowend_price && !$city && !$state)
{
    $query = "Select * from ".$look_in."";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && $highend_price && !$lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price 
    <= '".$highend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && $lowend_price && !$city && $state)
{
    $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && !$lowend_price && $city && $state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Price 
    <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && !$highend_price && $lowend_price && $city && $state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Title like '%".$search_term."%'";
}

else if ($look_in == "".$look_again."_Needs" && $search_term && !$highend_price && !$lowend_price && $city && $state)
{
    $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Title like '%".$search_term."%'";
}

$result = mysql_query($query) or die();


while ($row = mysql_fetch_assoc($result))
{
    if ($look_in == "General_Needs")
    {
    echo $row['General_Title'];
    echo $row['General_City'];
    echo $row['General_State'];
    echo $row['General_Price'];
    echo $row['General_Desc'];
        }

    else if ($look_in == "Cars_Needs")
    {
    echo $row['Cars_Title'];
    echo $row['Cars_Make'];
    echo $row['Cars_Year'];
    echo $row['Cars_Color'];
    echo $row['Cars_Price'];
    echo $row['Cars_City'];
    echo $row['Cars_State'];
    echo $row['Cars_Desc'];
        }

    else if ($look_in == "Housing_Needs")
    (
    echo $row['Home_Title'];
    echo $row['Home_Beds'];
    echo $row['Home_Pets'];
    echo $row['Home_Own_Rent'];
    echo $row['Home_Price'];
    echo $row['Home_City'];
    echo $row['Home_State'];
    echo $row['Home_Desc'];
        }
}
?>
</body>
</html>


is giving me this error: Parse error: syntax error, unexpected T_ECHO in /home/u2/kabbash615/html/ineedblank/Search_Results.php on line 219

Why?

I have done some research on the error and everyone says its a missing ; or a tag I opened and didnt end but I cannot find it... Please help!

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 May 2006 - 09:19 PM

Please post lines 215-220 for us.
Legend has it that reading the manual never killed anyone.
My site

#3 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 06 May 2006 - 09:27 PM

215: echo $row['Cars_State'];
216: echo $row['Cars_Desc'];
217: }
218:
219: else if ($look_in == "Housing_Needs")
220: (

While posting that I discovered one error: I had a ( instead of a { after housing needs... But i am still getting the same error

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 May 2006 - 09:27 PM

Shouldn't 220 be { not (
Legend has it that reading the manual never killed anyone.
My site

#5 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 06 May 2006 - 09:31 PM

Yea while posting I discovered that error... But I am still getting back the same error message, same line and everything...

#6 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 06 May 2006 - 10:20 PM

Anyone have any ideas why I am still getting this error?!

#7 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 06 May 2006 - 11:56 PM

I'm assuming you've uploaded the file with the { instead of the ( in it?
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#8 darga333

darga333
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 07 May 2006 - 07:06 AM

on line 219 try to put "elseif" instead of "else if"

does that work?

#9 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 08 May 2006 - 02:57 AM

I figured out my problem incase anyone was wondering for learning experiance.. Dreamweaver was not updating my files remote.


Thanks for the help everyone!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users