Re: Question about Arrays

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

 



At 7:04 PM +0100 10/10/06, Alex Major wrote:
Hi List.
I have a table, which contains 'setting' information for my website.
The table has the following columns: setting_id, setting_name and setting_value. Now there are currently 30 settings stored in this table, however i am having trouble pulling values out on a 'as needed' basis.

At the moment i have this select query:
    $settings_query = "SELECT * FROM `robin_settings`";
    $settings_result = mysql_query($settings_query);

And from that, i would like to pull individual results, for example...

I have a setting which has a 'setting_id' of "4", a 'setting_name' called "banner_on" and a 'setting_value' of "1".

How am i able to pull that information from the results i get?

I know i could pull it by putting a WHERE clause on the SQL query, however that would mean having 30 select queries per page and i don't really fancy that!

Thanks for any help! (i'm new at this :) )

Alex.


Alex:

I'm not trying to be a smart ass, but it might help if you look at the manual. If in doubt, always try looking up the function you are using (like mysql_query() ) and see what it does and how it works in the examples, like so:

http://us3.php.net/manual/en/function.mysql-query.php

To give you a hint as to your question, the variable "$settings_result" above is a resource where using another function mysql_fetch_array() will pull out what you want.

hth's

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux