I have table in mysql, have values in row i want when page loads the highest value is alwyas the selected one.
Im using two queries first one pulls the top value and adds it to box then it populates the rest, so it shows this top value twice, is there another way of addthem and if its the last or highest that one needs to be the selected one
<select name="price_to" id="select2">
<?php
$sqls = "SELECT fld_priceto FROM tbl_range ORDER BY fld_priceto DESC LIMIT 1";
$results = mysql_query($sqls);
while($rows = mysql_fetch_assoc($results)){
echo "<option selected='".$rows['fld_priceto']."'>".$rows['fld_priceto']."</option>";
}
$sql = "SELECT * FROM tbl_range";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
echo "<option value='".$row['fld_priceto']."'>".$row['fld_priceto']."</option>";
$i++;
}
?>
</select>