Re: Question about Arrays

From: Date: Wed, 11 Oct 2006 15:49:44 +0000
Subject: Re: Question about Arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242984@lists.php.net to get a copy of this message
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

« previous php.general (#242984) next »