Html many (~30) check-boxes like
<input name="heated_seats" value="1" id="heated_seats" type="checkbox">
<input name="electric_windows" value="1" id="electric_windows" type="checkbox">
<input name="cruise_control" value="1" id="cruise_control" type="checkbox">
User may check any of them (may check all, may check nothing).
Thinking about performance. Which option would be faster and use less resources?
Option 1
mysql
HeatedSeats | ElectricWindows | CruiseControl
----------------------------------------------
1 | 1 | 0
1 | 0 | 0
0 | 0 | 0
Query like SELECT HeatedSeats, ElectricWindows, CruiseControl .....
Php like if( HeatedSeats == 1 ){ echo 'HeatedSeats'; }
Many if
Option 2
mysql
OneColumnWithPossiblyLongVarcharOrText
----------------------------------------------
Heated seats, Electric windows, ''
Heated seats, '', ''
'', '', ''
Query like SELECT OneColumnWithPossiblyLongVarcharOrText .....
Php like
$arr = explode( ',' OneColumnWithPossiblyLongVarcharOrText )
foreach( $arr as $k => $v ){
if( strlen($v) > 0 ){ echo $v; }
}
For example many visitors do the same select on different rows.
Which option takes less time and uses less resources?
Or may be there some better option?