I have two classes which both extend from SQL class
like this:
class SQL {
private $db_connect_id;
function connect($ad, $db, $us, $pa){
$this->db_connect_id = mssql_connect($ad, $us, $pa);
mssql_select_db ($db, $this->db_connect_id) or die('sql error');
}
function sql_query($query = ""){
unset($this->query_result);
if($query != ""){
$this->num_queries++;
$this->query_result = @mssql_query($query, $this->db_connect_id) or die('error query');
}
if($this->query_result){
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
return $this->query_result;
}
}
}
class WEB extends SQL {
function __construct(){ $this->connect(params) }
function __destruct(){ $this->disconnect() }
}
class AUTH extends SQL {
function __construct(){ $this->connect(params) }
function __destruct(){ $this->disconnect() }
}
the problem is that if I call both of them
$WEB = new WEB();
$AUTH = new AUTH();
the $WEB
won't work anymore. It loses its connection with the database and it changes the db_connect_id with the db_connect_id from AUTH...
I think this is a stupid question and I'm too tired, but I have to finish.
Where I'm doing wrong?
Thank you