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!
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.