> OK I am trying to write a script that will bring data out of a database
into
> a select box. But what I need it to do is repeat 5 times or more depending
> on what it brings out. I can only get it to display one select box. Here
is
> what I got so far:
>
> <?php
> require 'common.inc';
> // Connect to the Database
> if (!($link = mysql_pconnect($DB_SERVER, $DB_LOGIN, $DB_PASSWORD))){
> DisplayErrMsg(sprintf("internal error %d:%s\n",
> mysql_errno(), mysql_error()));
> exit() ;
> }
> ?>
>
> <head>
> <title>Flavors Select</title>
> </head>
>
> <body>
> <?php
> // Send the Query to the Server, to get the list of flavors
> if (!($result = mysql_db_query($DB,"SELECT * FROM extras WHERE
name='$flav'
> ORDER BY 'choice'")))
> {
> DisplayErrMsg(sprintf("internal error %d:%s\n",
> mysql_errno(), mysql_error()));
> return 0 ;
> }
> ?>
> <font face="verdana" size="2" color="#000000">
> <form name="thisform" action="<?php $PHPSELF;?>" method="post">
> <select>
> <option><?php echo $flav; ?>
> <?php while(($row = mysql_fetch_array($result)))
> {
> ?>
> <option value="<?php echo $row["choice"]; ?>"><?php echo $row["choice"];
?>
> <?php
> } // End of while loop
> ?>
> </select>
> </form>
> </font>
> </body>
>
> <?php
> }
> ?>

Try to check if query doesn't return only one row, for example:

echo mysql_num_rows($result);

Luboslav Gabal


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to