Problem Establishing multiple database connection

Discussion in 'PHP' started by bird.23, Jun 26, 2009.

  1. #1
    can anyone help me out on how to establish connection to two databases using database class in same file ?
     
    bird.23, Jun 26, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Not sure exactly how your class works but you would need to provide 2 sets of credentials and instantiate the class 2 times.

    
    
    $db1 = new DbClass(DATBASENAME,USER,PASSWORD,HOST);
    
    $db2 = new DbClass(DATBASE2NAME,USER2,PASSWORD,OTHERHOST);
    
    
    PHP:
    It really depends on how the class is organized, but it should look something like this.
     
    jestep, Jun 26, 2009 IP