I want to extract some values from a table in PHP and MySql but not quite sure on how to do it.
The table contains two columns:
config_name || config_value
Example data is:
status || 1
maxview || loads
something || avalue
I need to get it somehow so that I could do things like:
if($settings[status]==1){
// do something
}
if($settings[maxview]=="loads"){
// do something
}
How is this done. Ive done it before but cant remember how.
Comments
If this is what you want to do you have to put
if($settings[status] == 1 && $settings[maxview] == 'loads'){
// Do sommat here
}
Photoshop Tutorials- Coming soon
Premium PHP Scripts- Coming soon
Haha i should really do some work so i can remove all the coming soon's
[php]$res = mysql_query("SELECT * FROM config");
$settings = array(); // our new array
//
// Build array
//
while($item = mysql_fetch_array($settings))
{
// Use the config_name as
// the $settings index key
$settings[ $item ] = $item;
}
//
// Use the values
//
if($settings == 1)
{
// ...
}
if($settings == 'loads')
{
// ...
}[/php]
Webmaster-Talk.com
Chroder.com
I figured it out yesterday
Thanks for your help anyway
The Royal Ram