Problem comes here...
In the user management class I have a function called init(); which obviously is called before any other functions are run and in the function I load the MySQL script like so:
Code: Select all
<?php
class usrmanage {
function init($dir="") {
include($directory."config.php"); // MySQL Configuration
include($directory."mysql.php"); // MySQL class
$this->con=new class_mysql();
$this->con->connect($directory); //connects to MySQL using config in config.php
//$directory is used to identify the folder in which the files which will be included in the MySQL script exists.
}
}
?>Code: Select all
<?php
$config['mysql']['host']="localhost";
$config['mysql']['username']="root";
$config['mysql']['password']="";
$config['mysql']['database']="radix";
$config['mysql']['prefix']="rdxls_";
?>Code: Select all
<?php
class class_mysql() {
var $root;
function connect($dir="") {
$this->root=$dir;
include_once($dir."config.php");
@mysql_connect($config['mysql']['host'], $config['mysql']['username'], $config['mysql']['password']);
@mysql_select_db($config['mysql']['database']);
}
}
?>Using a debugger I found out that the variable $config suddenly dissapears once its in mysql class. Its there in the usrmanage class but then it dissappears. Is this a problem with my variable scopes?
Thanks for you help in advance,
RadixDev