I have a php file tableinfo.php with this code ->
<?php
$table_info = array(
array(
'table_name' => 'managers',
'n_cols' => '4',
'col_info' => array(
'Name' => 's',
'ldap' => 's',
'avrsid' => 'i',
'bu' => 's'
),
)
);
?>
I have included this file in another file /controllers/connection.php like this ->
include $_SERVER['DOCUMENT_ROOT'] . '/controllers/tableinfo.php';
connection.php has a class called connection which, in a function uses $GLOBALS to access the array from the tableinfo.php like this ->
$types .= $GLOBALS['table_info'][0]['col_info'][$filters[self::filters][$i][self::field]];
Where $types is a string and $filters is another variable that has the field name that I want.
I autoload the connection.php like this ->
spl_autoload_register(function ($class) {
require_once($_SERVER['DOCUMENT_ROOT'] . '/controllers/' . $class . '.php');
});
Now, I have two pages, root/js/managers.php and the root/js/ldap.php, on managers.php everything works fine but on the ldap.php it gives this error ->
Notice: Undefined index: table_info in
C:\xampp\htdocs\avrs\htdocs\controllers\connection.php on line 76
I am not able to figure out what am I doing wrong. Please suggest. Thanks in advance.