AdRock Posted March 18, 2008 Share Posted March 18, 2008 I have search form where i can enter a keyword and i want to run a query that returns all results thjat have that keyword The problem is, it is returning all the records instead of the filtered records I am using MATCH to check all indexed fields with a variable to see if that variable appears in any of those fields these are the variables that are got from the form. i shall being using the $seats and $ dept later when i have this query working $address = $_REQUEST['address']; $seats = $_REQUEST['seats']; $dept = $_REQUEST['dept']; This is the queries if(!empty($address) && !empty($seats) && !empty($dept)) { $result = mysql_query("SELECT id,userid,seats_available,start_street,start_postcode,start_lat,start_long, end_street,end_postcode,end_lat,end_long,TIME_FORMAT(depart_time,'%H:%i') as depart, MATCH (start_street, start_postcode, end_street, end_postcode) AGAINST ($address) AS score FROM carshare ORDER BY score ASC LIMIT $offset,$entries_per_page"); } else { $result = mysql_query("SELECT id,userid,seats_available,start_street,start_postcode,start_lat,start_long, end_street,end_postcode,end_lat,end_long,TIME_FORMAT(depart_time,'%H:%i') as depart FROM carshare ORDER BY id LIMIT $offset,$entries_per_page"); } Link to comment https://forums.phpfreaks.com/topic/96785-search-form-full-text-sql-queries-not-working-correctly/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.