hi experts,
i am building a little database where i keep records of the contents of my numbered back-up dvds.
via a php form i can add a new item to a dvd. because i dont want to type in the dvd number manually, a dropdown box lets me select to which dvd i want to add the item. the values of this dropdown box are generated with this php code:
<?php require_once('FAV.php'); ?>
<?php
mysql_select_db($database_FAV, $FAV);
$result = mysql_query("SELECT dvdnumber FROM backupdvds ORDER BY dvdnumber ASC");
$row = mysql_fetch_row($result);
if (!$result) {
echo "DB Error";
echo 'MySQL Error: ' . mysql_error();
exit;
}//if
?>
<!--some HTML is here-->
<form action="saveitem.php" method="get">
<!--some more HTML is here-->
<!--now comes the dropdown-->
<select name="dvdnumber" id="dvdnumber">
<?php
do {
?>
<option value="<?php echo "$row[0]\n"?>">
<?php echo "$row[0]\n"?>
</option>
<?php
}//do
while ($row = mysql_fetch_row($result));
$rows = mysql_num_rows($result);
if($rows > 0) {
mysql_data_seek($result, 0);
}//if
?>
</select>
<!--some more html and the other form fields here-->
the whole thing works fine except for the fact that the dropdown displays the dvd numbers multiple times like shown in this gif
is there a simple solution to avoid these duplicates?
tia,
jogol