Re: Using two colomns of mysql data as key/value pairs in arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ignatius, the original poster mentioned "an associative array" - The
mysql_fetch_assoc() function fetches an associative array. If you want only
that, use that function, if you want indices, use the mysql_fetch_row()
function. If for some reason you need both, then you should use the
mysql_fetch_array() function; don't assign what you won't use.


-- 
Jon Kriek
http://phpfreaks.com

"Ignatius Reilly" <ignatius.reilly@free.fr> wrote in message
004301c3970f$36c32c50$0100a8c0@server">news:004301c3970f$36c32c50$0100a8c0@server...
> mysql_fetch_array( $result )
>
> _________________________
> ----- Original Message -----
> From: "Devon" <omicron9@comcast.net>
> To: <php-db@lists.php.net>
> Sent: Monday, October 20, 2003 3:30 PM
> Subject:  Using two colomns of mysql data as key/value pairs in
> arrays
>
>
> > I have been scouring the online documentation and experimenting for
> > hours trying to find a solution. I just can't do it.
> >
> > I have two colomns of data that I am retrieving from MySQL:
> >
> >    SELECT id, name FROM a_table;
> >
> > I just cannot figure out how to get that data from the resource handle
> > into an associative array with the 'id' colomn making up the keys and
> > the 'name' colomn making up the values.
> >
> > Any help would be wonderful! :)
> >
> >
> >
> > Using PHP 4.3.3 on Linux if it matters.
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux