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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.