NYCPHP Meetup

NYPHP.org

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

Daniel Kushner nyphp at websapp.com
Wed May 21 14:57:18 EDT 2003


This is an informative thread, but can the subject please be changed?  :)

--DK



> -----Original Message-----
> From: Joshua S. Freeman [mailto:jfreeman at amnh.org]
> Sent: Wednesday, May 21, 2003 2:56 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] I'm stupid...
>
>
> 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...
>
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>





More information about the talk mailing list