ok well this is a very bad example. I know the query doesnt work or anything yet and the code is scrappy but thats because im only trying to build the query at the moment...
PHP Code:
<?php
//Return Query Builder
$manufacture_query = $_GET['manufacture'];
$berth_query = $_GET['berth'];
$location_query = $_GET['location'];
$keywords_query = $_GET['keywords'];
$from_query = $_GET['from'];
$to_query = $_GET['to'];
$private_query = $_GET['private'];
$trade_query = $_GET['trade'];
$year_query = $_GET['year'];
$man_id2 = $manufacture_query;
if($from_query != ""){$search_returned = 1;}
if($_GET["manufacture"] == "0"){$manufacture_query = "";}
if($_GET["location"] == "0"){$location_query = "";}
if($_GET["year"] == "0"){$year_query = "";}
if($_GET["berth"] == "0"){$berth_query = "";}
//Attempting to echo results
echo $manufacture_query . "<br>" .
$berth_query . "<br>" .
$location_query . "<br>" .
$keywords_query . "<br>" .
$from_query . "<br>" .
$to_query . "<br>" .
$private_query . "<br>" .
$trade_query . "<br>" .
$year_query . "<br>";
if($search_returned = 1){
$result = "SELECT * FROM `adverts` WHERE `manufacture_id` ='$manufacture_query' && location_id ='$location_query' ORDER BY `timestamp` DESC";
echo $result;
}
else { $result = "SELECT * FROM `adverts` ORDER BY `timestamp` DESC"; }
Im pretty sure there is nothing wrong with the way i attempt to echo the variables...i did a var_dump and the result came back NULL so the $_GET doesnt want to collect the data from the url.
Heres a (not) working example.
http://www.caravansandtrailertents.co.uk/search/ The page should show the query trying to be built for development purposes and it should try to echo the variable...thats why the code shows a series of <br>'s with no information.
The reason i dont want to use search/index.php is because caravansandtrailertents.co.uk/search/ is a mod_rewrite in my .htdocs for the url ...co.uk/index.php?pageref=search