NYCPHP Meetup

NYPHP.org

[nycphp-talk] I'm stupid...

Joshua S. Freeman jfreeman at amnh.org
Wed May 21 14:55:43 EDT 2003


Like this?


mysql_connect($host, $user, $password)
    or die("Could not connect to database");
mysql_select_db($database)
    or die ("Could not select $database database");

print "The current database is $database";

 $query= mysql_query("select * FROM order");

22  $result = mysql_fetch_assoc($query);
23        print ("<select name=\\"order\\">");
24        foreach ($result as $key=>$val)
25        print "<option value=\\"1\\>$val</option>";
26        print ("</select>");
    
        
        ?>


when I try to run this in the browser I get this:


Warning: Supplied argument is not a valid MySQL result resource in
/Users/jfreeman/Sites/wasps/test.php3 on line 22

so... i guess i'm still close.. but no cigar..

J.


On 5/21/03 2:48 PM, "Malcolm, Gary" <gmalcolm at professionalcredit.com> wrote:

> your $query just returns a pointer to the mysql result set... it is not an
> array
> 
> now use mysql_fetch_assoc($query); to get each row in tuern as an assoc
> array...




More information about the talk mailing list