Chris wrote:
julian wrote:
warn: already posted in general.... with no response... maybe is too
basic.. but I RTFM and still is not clear to me what I am doing
wrong....
I want to open a database connection at program initialization and use
that very same connection via globals initilizating ( loading from db)
other objects.
Basically
index.php
require_once ('file.php');
$db=new mysqli(host,us,pass,db);
The order of this stuff matters.
$db isn't set up when you include file.php, hence why it's not an object
when you try to use it.
move the $db = .. line above the file.php reference.
[ I'm sure you would have received a notice or warning or something if
you had error_reporting set to E_ALL and display errors on ]
Hi Chris,
Thanks for your comments. I do have E_ALL set.
Your view does no explain why in one class it does work and in the other
class it does not. Both classes defined in same file.
However, I will try later in the day you idea and will post results.
many thanks.
JCG
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php