Another Class problem [SOLVED]
Posted: Sat Jul 22, 2006 3:23 pm
I'm really glad I finally tried classes. But I'm a newbie and here is my problem:
inside the function config() it works.
What I want to do is when I call $main->config(); I have an array with my config settings.
Code: Select all
class Main
{
function config()
{
global $tb;
$config = array();
$query['config'] = mysql_query("SELECT * FROM `" . $tb['config'] . "") or die(mysql_error());
while($row = mysql_fetch_array($query['config']))
{
$config[$row['config_name']] = $row['config_value'];
}
return $config;
}
}Code: Select all
$main = new Main;
$main->config();
print_r($config);If I doNotice: Undefined variable: config in /home/*/public_html/includes/header.php on line 28
Code: Select all
print_r($config);inside the function config() it works.
What I want to do is when I call $main->config(); I have an array with my config settings.