//select parent_id - display unique value
<?php
//database connection
$con = mysql_connect("xxxx","xxxx","xxxx");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("btreedata", $con);
//select distinct query
$query = mysql_query("SELECT DISTINCT parent_id FROM btree");
$result = mysql_query($sql);
//dropdown list
echo "<select name='parent_id'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='".$row[0]."'>".$row[0]."</option>";
}
echo "</select>";
?>
输出显示如下:
1000
1000
1004
1004
1003
1001
1005
1001
我怎样才能只显示
1000
1001
1003
1004
1005