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" <[EMAIL PROTECTED]>
To: "Rick Emery" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]>
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: [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