In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> 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))
replace the above with
while ($row = mysql_fetch_array($sql))
If will be true, but will only produce one result. You want to iterate
through all results, which is why you use while. It will return as many
results as are available.
> print "<OPTION VALUE=\"$tutor_name\" SELECTED>" .$row
> ["tutor_name"]. "</option>";
> $result = $db->query($sql);
> Thanks in advance =)
Quod subigo farinam
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
Q: What is the most annoying thing on usenet?
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php