Jump to content

Checkboxes and MySQL


frikus

Recommended Posts

These values are coming from a user posting an online car ad.

On 'Build Your Ad' page users can check all the corresponding checkboxes, so the list of available features will show up in the ad.

Something like this:

 

'Features: Air Conditioning, Driver Side Air Bag, Passenger Side Air Bag, Anti-Lock Brakes, AM/FM Radio, Security Features, Alloy Wheels, All Wheel Drive, Bucket Seats, Center Arm..'

 

Other users can do advanced search for cars by these features - they select Make, Model, Year and check the checkboxes with the features they want.

 

I assume that i need a separate row for each car feature in the main 'car_ads' table.

The simplified version of this table can look like this:

 

idmakemodelyearair_bagspower_windowscd_changer

12307DodgeNeon2003

1

0

0

12407BmwX52004

1

1

1

12507DaewooLanos2001

0

0

0

 

But by building the table this way I will end up with too many rows, because there are so many features in modern cars.

Is there a better way to accomplish this or having many rows in a table is ok?

 

featuresnn7.jpg

 

Link to comment
https://forums.phpfreaks.com/topic/80650-checkboxes-and-mysql/#findComment-409193
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.