I am doing that - sorry, should have given you a bit more code...
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");
function doSomething ()
$sql = "select * from table";
$this->sth = mysql_query ($sql, $this->conn);
// do something with query...
Is there something inherently static about msql connections?
"Stuart Dallas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Friday, May 31, 2002 at 4:11:42 PM, you wrote:
> > When I try to work with the first instance of my class, I get an error
> > 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
> > like a static var.
> You need to specify $this->conn in each mysql_* function you call
> will be called against the last connection made.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php