HOW TO connect to multiple databases at the same time?

Talk and info about common issues and learn how to do almost anything with ApPHP AdminPanel

Moderator: alexandrleonenko

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO connect to multiple databases at the same time?

Postby administrator » Sep 5th, '11, 12:00

Sometimes you may need to be connected to different databases at the same time.
for example: to log and manage users from one database and manages pages from another.

In such case you have to create 2 different configuration files, each of them will include connection data for different database.
Configuration file is placed in inc/ folder and called config.inc.php

So you may perform installation on your main database (let say this is database A), then create a copy of config.inc.php, where to insert manually connection parameters for another database (let say it called B).

The last thing you have to do it to include in appropriate pages config_B.inc.php inctead of config_A.inc.php
and then use it for your code.

Return to “ApPHP AdminPanel {HOW TO}”