Re: How can I include mysql-query results as <options> in a html-skript?
| From: | Stefan Goethals | Date: | Mon, 09 Oct 2000 14:32:52 +0000 |
| Subject: | Re: How can I include mysql-query results as <options> in a html-skript? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19194@lists.php.net to get a copy of this message | ||
Joachim Ritzer wrote:
>
> hi everybody,
>
> Since a few days I try to include the result of a MySQL-query as options
> into html-skript. I know this sentence is not very precise, but if you may
> take a look on the following lines (see <OPTION>) you will know what I´m
> talking about.
>
> <?
> $query = ("SELECT matrikelnummer FROM diplomanden ORDER BY matrikelnummer");
> $result = mysql_query($query, $db);
> $number = mysql_num_rows($result);
> $matrikelnummer = mysql_fetch_array($result,MYSQL_NUM);
> ?>
> ...
> <TR>
> <TD bgColor=#ffe4b5>Matrikelnummer:</TD>
> <TD><SELECT id="" name=matrikelnummer
> style="HEIGHT: 22px; WIDTH: 150px">
<?php
while ($result = mysql_fetch_object($qid)) {
$output .= "<option value=\"" . $cat->matrikelnummer .
"\">" .
$cat->matrikelnummer;
}
?>
> </SELECT>
I didn't test this modified bit of code, but the principle works.
--
Stefan - Zipkid - Goethals
YourNet - Open source web design & Site management.
http://www.yournet.be
mailto:stefan@yournet.be