Hello, I dont know if I am posting this is the right forum so if it is not please let me know.
Here is what I am trying to do. I am building an inventory selection page that will search the inventory based on the model year, model number, exterior and interior color, and option codes the user chooses (ie. Automatic Transmission, Wheel Locks, etc.).
Now I can get the query to show me results for the model year, model number, exterior and interior color, which is pretty simple but the problem I have is how to have it give me results based on options.
Say the user wants to search for a vehicle, they have entered the model year, model number, exterior color, interior color, and has chosen a few options. How can I get it to provide me results based on the amount of options "matched" for a particular stock number. In other words how do i make it display from the most amount of matches to the least.
Here are the values being sent...
imodel_number = "MZ6SSPA"
imodel_year = "2006"
imodel_ext_color_id = "26A"
imodel_int_color_id = "GJ7"
imodel_status_code = "1"
imodel_option_codes = "AT2,CE2,WLK,1MC"
Here are my tables...
inventory
- inv_id (auto-increment, primary)
- stock_num (int)
- model_year (int)
- model_number (varchar, 255) - these are alphanumeric
- vin (varchar, 255)
- ext_clr_code (varchar, 255)
- int_clr_code (varchar, 255)
- status_code (int)
inventory_options (each option_code for the stock number is on a separate row)
- io_id (auto-increment, primary)
- stock_num (int)
- option_code (varchar, 255)
Any help on this would be greatly appreciated. Also some read up material would be nice too. Thank you.