How to connect 2 databases in php-sql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
imhoteb
Forum Newbie
Posts: 1
Joined: Mon Sep 24, 2007 5:21 pm

How to connect 2 databases in php-sql

Post by imhoteb »

Is ther possible to have 2 php scripts that can share the same line of USER and PASS ?
Can I install that scripts to share like that ?
Do I have to do something else?
[s]pls[/s] please help , I'm new to this.
Thank you
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
Last edited by imhoteb on Tue Sep 25, 2007 7:37 am, edited 1 time in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

config.php

Code: Select all

<?php

$Config = array(
     'username' => 'xxx',
     'password' => 'yyy',
     );
foo.php

Code: Select all

<?php
include 'config.php';

$db = new DB($Config['username'], $Config['password']);
bar.php

Code: Select all

<?php
include 'config.php';

$db = new DB($Config['username'], $Config['password']);
(#10850)
Post Reply