Hi all,
I've recently begun working with mysqli in a php site in order to make use of bound queries.
Now I have a config file that I am including in all pages that has something similar to:
$dbc = new mysqli(_HOST,_USER,_PASS,_DBNAME);
and this works as expected. If I then execute a query on a page (say index.php) it works as expected.
If I then have a class that is included on the page AFTER the config script and I want to do some DB stuff in that class I get an undefined variable message (when using $dbc as the variable)
Am I doing something really stupid here? Does the $dbc need to be passed into the class? How can I set it so that I have my $dbc object and I can access it within other classes?
Many Thanks