Jump to content

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


twizler

Recommended Posts

This code:

[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>[/code]


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!
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.