Can anyone here shed some light on this issue? I have a class which is responsible for it's own database access and (some of it) is initalised as below:
<? class myClass { var $conn; var $sth; // etc... function myClass ($db) { $host = "localhost"; $user = "user_name"; $password = "password"; $this->conn = mysql_connect ($host, $user, $pwd) or die ("Unable to connect to database"); $sel = mysql_select_db ($db, $this->conn); if (!$sel) die ("Unable to select database"); return true; } // rest of the class } ?> Now, say for example the class is used as per the script below: <? require ("myClass.class"); $c1 = new myClass ("first_database"); $c2 = new myClass ("second_database"); // error here $c1->doSomething(); ?> When I try to work with the first instance of my class, I get an error which I finally tracked down to it trying to run it's SQL queries against the database defined in $c2. Now, I was under the impression that class variables were private to each instance, however, this seems to be acting like a static var. Help?!? Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php