php - Take out one record from database to select list -


i have question take record select list.

it database

|height | width| |82     | 450  | |110    | 450  | |120    | 450  | |140    | 600  | |150    | 700  | 

php code

 <?php     function width(){     mysql_connect("localhost", "root", "root") or     die("could not connect: " . mysql_error());     mysql_select_db("partition");      $query = "select width width_height width='450' limit 1;";     $result = mysql_query($query);     $row = mysql_fetch_row($result);     echo("$row[0]");     mysql_free_result($result);     }  ?>     <p>width (mm):     <select name="width" id="width1">     <option><?php width(); ?></option>     </select><br> 

my expect select list:

width: |450|        |600|        |700| 

here, want take out 450,600,700 record , display on select list

it sql language problem or php...???
have suggestion me?

to unique list of widths, change query to

 $query = "select distinct width width_height;"; 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -