only1perky Posted February 15, 2009 Share Posted February 15, 2009 Hi Guys I going mad here as I can't get my advanced search working and I don't know why. At the moment I have a search page with a text box and select option and some checkboxes. If I just use the text box and checkboxes it works fine. However when I use the select box and checkboxes it ignores my sql. Here is my code: if($_GET['criteria'] != "" && $_GET['area'] != "") { mysql_select_db($database_connuser, $connuser) or die; $find3 = $_GET['area']; $find = implode("=1 AND ",$_GET['criteria'])."=1"; $query = "select * from table where area like \"%$find3%\" AND ".$find." order by featured desc, venue asc"; Now when I echo the query it completely ignores the first area and goes straight to the checkbox criteria. I know $_GET['area'] is being passed as when I simply search by area alone it works fine. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
farkewie Posted February 15, 2009 Share Posted February 15, 2009 Hi, Try this <?php $query = "SELECT * FROM table WHERE area LIKE \"%$find3%\" AND area LIKE ".$find." ORDER BY featured DESC, venue ASC"; ?> You had not added a field to compare $find to. I also recommend using UPPERCASE for standard SQL words for ease of reading. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.