BCAV_WEB Posted November 19, 2010 Share Posted November 19, 2010 I have an input box, where a user can type in anmy vehicle they want it checks it against one table called "cars" and brings back the relevent info, I also want it to bring back the colours for that car. I have got this working, but it is very specific using "Like", so if the user searchs KA it works fine, but if they search Ford KA then it won't bring it back. A soultion around this is using %LIKE%. The issue is say I have one colour perfromance blue that is available for the KA, Fiesta and Focus RS but not the Focus titanium how would I get it to search this without duplicated data. My first thought was having a field called "Model" with data in like KA Fiesta Focus RS and use the %LIKE%., but because the Focus titanium has the word focus the colour will still get pulled out. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/219183-search-tags-for-mutliple-vehicles/ Share on other sites More sharing options...
fenway Posted November 21, 2010 Share Posted November 21, 2010 You're talking about a proper full-text search, then? Quote Link to comment https://forums.phpfreaks.com/topic/219183-search-tags-for-mutliple-vehicles/#findComment-1137530 Share on other sites More sharing options...
BCAV_WEB Posted November 22, 2010 Author Share Posted November 22, 2010 well a user might search for a car in the following ways, I'll use a ford fiesta TDCi titanium 1.6 litre diesel as an example. Ford Fiesta Ford Fiesta Titanium Ford Fiesta Titanium Currently I have 4 fields make (ford) model (fiesta titanium) extras (1.6 diesel) and search (ford fiesta TDCi titanium 1.6 litre diesel) and I'm using the %LIKE% to search all 4 fields in this manner. In relation to the colours, I now have this working fine and comes back with the correct colours for each car, but I would like a more efficent search method or do you think this one would do? Also to add more control I have done the following code, which works fine on firefox but doesnt on IE any suggestions on how to fix the IE?? Go to www.bikescarsandvans.co.uk/test.php to see it for yourself / test it. Finally any suggestions on how to get it so I can limit the data to say 50 records and then the next 50 to go onto another page? I know I can limit the results with my query but cant figure out the best soultion of the top of my head. Cheers print " <form target='_self' method='POST'> <table class=''> <tr> <td> <input name='vehicle' type='text' id='search_name' size='16'> <input type='image' src='images/search.gif' alt='Search' name='submit' id='search' value='Search'/> </td> </tr> <tr> <td> <select name='filter' id='filter'> <option value='make' selected='selected'>Filter By</option> <option value='make'>Vehicle Manufacture</option> <option value='model'>Vehicle Model</option> <option value='our_price'>Price</option> <option value='delivery_time'>Delivery Time</option> </select> </td> </tr> <tr> <td> <input type='radio' name='direction' value='ASC' checked/>Ascending <input type='radio' name='direction' value='DESC' />Descending </td> </tr> </form> "; include "connections/dbconnect.php"; if(isset($_POST['submit'])) { $vehicle = $_POST['vehicle']; $filter = $_POST['filter']; $direction = $_POST['direction']; } else { $filter = "make"; $direction = "ASC"; } //$manfactures = "Ford"; $car_query = " SELECT * FROM cars WHERE model LIKE '%$vehicle%' OR make LIKE '%$vehicle%' OR model_details LIKE '%$vehicle%' OR search LIKE '%$vehicle%' ORDER BY $filter $direction "; Quote Link to comment https://forums.phpfreaks.com/topic/219183-search-tags-for-mutliple-vehicles/#findComment-1137862 Share on other sites More sharing options...
fenway Posted November 23, 2010 Share Posted November 23, 2010 Any questions about colours and browsers belong on another board. Pagination is also heavy discussed on this board (many, many threads) as well as the PHP Help board as well. Quote Link to comment https://forums.phpfreaks.com/topic/219183-search-tags-for-mutliple-vehicles/#findComment-1138356 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.