PHP + MySQL
am 18.07.2007 22:18:09 von Dan Maret
------=_Part_60863_25448599.1184789889616
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I just can't figure it out and Google yielded no help. I have a table named
'settings' which contains two fields, 'item' and 'content'. What I would
like to do is grab that data and use the 'item' field as the name, and use
the respective 'content' as the value in an array. For Example:
Array (
copyright => Copyright 2007 yada yada
version = > 2.15.1
)
That way I can do = $settings['version'] ?>
Can you help point me in the right direction? Any help would be greatly
appreciated!! :-D
--
-Dan
------=_Part_60863_25448599.1184789889616--
Re: PHP + MySQL
am 19.07.2007 00:12:16 von Dimiter Ivanov
On 7/18/07, Dan Maret wrote:
> I just can't figure it out and Google yielded no help. I have a table named
> 'settings' which contains two fields, 'item' and 'content'. What I would
> like to do is grab that data and use the 'item' field as the name, and use
> the respective 'content' as the value in an array. For Example:
>
> Array (
> copyright => Copyright 2007 yada yada
> version = > 2.15.1
> )
>
> That way I can do = $settings['version'] ?>
>
> Can you help point me in the right direction? Any help would be greatly
> appreciated!! :-D
>
> --
> -Dan
>
You need mysql_fetch_assoc() / mysql_fetch_array() functions
http://www.php.net/mysql_fetch_assoc
http://www.php.net/manual/en/function.mysql-fetch-array.php
They come with a good examples in the manual pages.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php