cyberwired
07-11-2005, 07:51 AM
I've been trying to think of different ways to do this and I think I just need a fresh thought from someone who might already have done it.
Heres basically what I'm trying to achieve:
Web site is going to list cars online. Will be designed in PHP and mysql
Where I've gotten a little stuck is the car details page.
I want to be able to add features to the cars with a tick box.
Eg ABS Brakes, Air Bag(s), Air Conditioning
What I'm not sure on is how to store it in the database.
I could have a number of fields for every feature and a yes or no as to whether the car has it but when I want to add a feature that will be annoying.
If I could somehow have another table with all the features to choose from and they are stored in a csv style in the other table that would be good, problem with this comes when there are more than 9 items
Eg if I had ID numbers on the features and added these numbers to the Car feature field like 1,3,5,6 it would say that it uses those items.
When it has 1,3,5,10,11,12 though and it could display that alright but when it comes to searching on that that I will have a problem
As in if I searched for all cars that had feature with ID 1 it would pick all cars that had a 1 in the field (so it would get 10, 11, 15 etc)
Anyone got any advise on this?
Heres basically what I'm trying to achieve:
Web site is going to list cars online. Will be designed in PHP and mysql
Where I've gotten a little stuck is the car details page.
I want to be able to add features to the cars with a tick box.
Eg ABS Brakes, Air Bag(s), Air Conditioning
What I'm not sure on is how to store it in the database.
I could have a number of fields for every feature and a yes or no as to whether the car has it but when I want to add a feature that will be annoying.
If I could somehow have another table with all the features to choose from and they are stored in a csv style in the other table that would be good, problem with this comes when there are more than 9 items
Eg if I had ID numbers on the features and added these numbers to the Car feature field like 1,3,5,6 it would say that it uses those items.
When it has 1,3,5,10,11,12 though and it could display that alright but when it comes to searching on that that I will have a problem
As in if I searched for all cars that had feature with ID 1 it would pick all cars that had a 1 in the field (so it would get 10, 11, 15 etc)
Anyone got any advise on this?