Posted by frizzle on 04/25/06 22:30
David Haynes wrote:
> frizzle wrote:
> > David Haynes wrote:
> >> $result[] = causes the result to be pushed onto an indexed array not an
> >> associative array. See inline for fix.
> >>
> >> -david-
> >>> $get_res = mysql_query(QUERY);
> >>>
> >>> if( $res = mysql_fetch_array( $get_res ) )
> >>> {
> >>>
> >>> do{
> >>>
> >> $result[$res['field1']] = $res['field1 value'];
> >>> } while( $res = mysql_fetch_array( $get_res ) );
> >>>
> >>> };
> >>>
> >>> foreach( $result as $key => $value ){
> >>>
> >>> print_r($value);
> >>>
> >>> };
> >
> > David,
> >
> > i don't alwas know all fieldnames beforehand.
> > So SELECT * should also put all fieldnames as
> > keys in the array.
> >
> > Frizzle.
> >
> My assumption was that one column in the table being queried formed the
> keys for the associative array. If so, then my method works. If not,
> what were you planning on using as the key to the array?
>
> -david-
I'm sorry, i don't understand what you mean ...
(my lack of english comes to play ... )
[Back to original message]
|