Display Mysql Result in drop down list
| From: | irinchiang at justeducation dot com | Date: | Tue, 23 Dec 2003 04:52:30 +0000 |
| Subject: | Display Mysql Result in drop down list | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-32167@lists.php.net to get a copy of this message | ||
Hi all,
Right now I'm trying to retrieve one of the column "tutor_name" and display al
the tutor's name in a drop down list. The problem now is, the drop down list
only manage to display 1 record from that row instead of all tutor's name
under "tutor_name" column...wonder where the problem lies??
Hope to get some help soon.
Below is a snip of the code:
Drop me a msg if anyone needs the entire code.
<SELECT NAME="tutor_name" class="textarea">
<?
$sql = mysql_query("SELECT DISTINCT tutor_name FROM tutor ");
if ($row = mysql_fetch_array($sql))
{
print "<OPTION VALUE=\"$tutor_name\" SELECTED>" .$row
["tutor_name"]. "</option>";
}
$result = $db->query($sql);
?>
</select>
Thanks in advance =)
Irin.