Populate drop down list from database

I`m using this code to repopulate drop down list from the database :\[code\] $city_id = 15; while($row = mysql_fetch_assoc($result)) { $selected = ($row['city_id'] == $city_id) ? 'selected="selected" ' : NULL; echo '<option value="'.$city_id .$selected . '">"'.$row['city_name'].'"</option>\n'; }\[/code\]It`s work like a charm but my question is are they more elegance solutions ?
 
Back
Top