Given a file called index.php which contains:
$db = NewADOConnection($db_dsn);
if (!$db) die("Connection failed");
$arrpage = $db->GetArray("SELECT * FROM somewhere");
include("functions.inc.php");
details("SELECT * FROM somewherelse");
The $arrpage contains the expect information
Then in the functions.inc.php file:
function details($query) {
global $db; //should check to make sure it exists
$options_array = $db->GetArray($query);
The $options_array is empty even though it should contain data.
var_dump($db) shows the DB object is all there. var_dump($options_array) is blank.
- PHP 5.3.4
- MySQL 14.14
- ADODB 5.14
Well after a lot of troubleshooting, all I needed to do was get up, have a pint of good beer and come back to it another time.
The short of it is: the system uses caching and upon close inspection of my error logs I noticed that the the cache files weren’t being written to the cache folder because of folder permission issues.
I therefore fixed the folder permissions and now that the cache files can be saved, the DB query has something to refer to.
Thanks for the help anyways, I do appreciate it.