Path Inclusion/Global variable not working?
Posted
by
Dan LaManna
on Stack Overflow
See other posts from Stack Overflow
or by Dan LaManna
Published on 2011-01-08T13:47:02Z
Indexed on
2011/01/08
13:53 UTC
Read the original article
Hit count: 113
Simply put, my config file includes my database class, and the config file has in it:
global $db;
$db = new database(DB_HOST, DB_NAME, DB_USER, DB_PASS);
That file is root/config.php
Moving on to root/functions/func.newpage.php doesn't have any includes/requires, and uses $db->classfunction since the file I'm working with:
root/newpage.php - requires the config file, as well as func.newpage.php.
However I still come up with: Undefined variable db.
Anything you guys are seeing I'm not? Thanks! Let me know if more details are needed.
© Stack Overflow or respective owner