Thank you Michael... That did the trick :D

thank you very very much, it took me three days... and now it seems so damn
easy.

vamp
"Michael Nolan" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Elliot J. Balanza wrote:
> > I need to make a query to a MySQL database that only has two fields,
name &
> > value. That I can do.
> >
> > Then I need to store the values i receive in an array in the form of:
> >
> > $variable['name'] = value;
> >
> > But haven't been able to do it neither with a foreach nor with a do
while...
> > Can anyone please assist me?
> >
>
> If you mean how do you store all the returned results in an array of
> name/value pairs, this is how I'd do it:
>
> <?php
>
> while ($result = mysql_fetch_assoc($query)) {
>      $variable[$result['name']] = $result['value'];
> }
>
> ?>
>
> Don't know what 'value' represents, but it will give you an array
> something like this:
>
> print_r($variable);
>
> Array
> (
>      [michael] => nolan
>      [joe] => bloggs
>      [john] => smith
> )
>
>
> HTH,
>
> Mike

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

Reply via email to