Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 906501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:23:57+00:00 2026-05-15T16:23:57+00:00

I have two classes which both extend from SQL class like this: class SQL

  • 0

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

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:23:57+00:00Added an answer on May 15, 2026 at 4:23 pm

    http://php.net/manual/en/function.mssql-connect.php

    There is fourth param new_link that must be passed as true (because default is false).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two classes which both derive from the same parent: public class People{
I have two classes (MVC view model) which inherits from one abstract base class.
I have a MustInherit Parent class with two Child classes which Inherit from the
I have two classes which look like this in barebones form: @interface GraphNode {
Say I have two classes which extend Event : public class CustomEventOne extends Event
I have two classes namely classA and classB which both inherit from class1 .
I have two classes one of which inherits from the other. Im trying to
I have a class that instantiates two classes which implement interfaces. I want one
I have two async classes in my application which you can see below class
having this two classes I always have a doubt of which is the best

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.