[PHP] Re: problems accesing an object via globals

2007-12-03 Thread julian
however this will work... p1.inc 1 var;; 9} 10 } 11 12 class obj { 13var $obj2=20; 14 15function f1(){ 16 global $db; 17 18 echo "\n".$db->fun2()*$this->obj2."\n"; 19} 20 } 21 ?> 1 #!/usr/bin/php -q 2 3 f1(); 13 14 ?> -- PHP General Mailing L

[PHP] Re: problems accesing an object via globals

2007-12-01 Thread julian
julian wrote: 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 $db=new mysqli(host,us,pass,db); if(mysqli_connect_errno()){ die('errordb conex'); } switch