Re: does this work?
| From: | DL Neil | Date: | Thu, 10 Jan 2002 23:13:02 +0000 |
| Subject: | Re: does this work? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80109@lists.php.net to get a copy of this message | ||
Erik,
Two suggestions:
1 check out mysql_fetch_assoc(), and
2 make use of AS to 'set' the variable names (carried through from MySQL to PHP).
Regards,
=dn
----- Original Message -----
From: "Erik Price" <pricee@hhbrown.com>
To: "Rick Emery" <remery@excel.com>; "PHP"
<php-general@lists.php.net>
Sent: 10 January 2002 22:15
Subject: Re: [PHP] does this work?
> But as I was writing before, what I'm really trying to do with this
> isn't just echo the COUNT of records in a table.
>
> What do I need to separate the array "$temprow" into pieces so that I
> can get at the data:
>
> $tempsql = "SELECT divisions.div_name, divisions.div_id
> FROM divisions";
> $tempresult = mysql_query($tempsql, $db);
> $temprow = mysql_fetch_array($tempresult);
>
> I wonder if I'm being too ambiguous in describing this.
>
> $temprow now contains the information extracted from $tempresult by
> mysql_fetch_array(), right?
> And $tempresult was the result of the SELECT query I posted above.
>
> So, how can I separate the information in $temprow into useable chunks
> or variables. I'm reading about explode(), but it isn't clear to me how
> I can use this in this instance.
> I would like to loop through the array "$temprow" and echo each record's
> contents (divisions.div_name and divisions.div_id) on each step. This
> is to populate a <select> box (listbox).
>
> Any advice, anybody?
>
> Thank you,
> Erik
>
>
> On Thursday, January 10, 2002, at 05:00 PM, Erik Price wrote:
>
> > Wait, my bad. Typo... all my fault.
> > I feel like an ass.
> >
> >
> > Erik
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>