OK so how would that look if I'd done SELECT * instead of SELECT eventName?
I'm guessing I have two nested while loops then?

I'm guessing something like this.....?  Or is it not possible and I have to
go back to mysql_result?

<?php
    mysql_connect("db", $user, $password);
    $result = mysql_query( "SELECT * FROM $table");

    while(list($field) = mysql_fetch_column($result))
    {
          while(list($value) = mysql_fetch_row($result))
            echo "<option>$value</option>\n";
    }
?>

- seb

-----Original Message-----
From: Lenar [mailto:[EMAIL PROTECTED]]
Sent: 26 July 2001 13:16
To: [EMAIL PROTECTED]
Subject: Re: [PHP] html form question


> Funny you should ask - just done it myself:

Why you use mysql_result function?

This can be done a bit simpler way (and more effective):

<?php
    mysql_connect("db", $user, $password);
    $result = mysql_query( "SELECT eventName FROM $table");
    while(list($event) = mysql_fetch_row($result))
        echo "<option>$event</option>\n";
?>

Lenar

>
> <?php
>   $table="shoots";
>   require ("connect.php4");
>   $result=MYSQL_QUERY( "SELECT eventName FROM $table");
>   $num_rows = mysql_num_rows($result);
>
>   for ($i=0;$i<$num_rows;$i++)
>   {
>   echo "<option>";
>   echo mysql_result($result,$i,"eventName");
>   echo "</option>";
>   }
>
>
>   MYSQL_CLOSE();
> ?>
>
> - seb



--
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]



-- 
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