Current location: Hot Scripts Forums » Programming Languages » PHP » Help with Multiple DB connections


Help with Multiple DB connections

Reply
  #1 (permalink)  
Old 05-07-04, 09:36 PM
JoJo26 JoJo26 is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Help with Multiple DB connections

I need to connect to 2 different databases on 2 different servers.

I tried:

<?php

$link1 = mysql_connect("ip here user pass")
or die("Could not connect: " . mysql_error());
mysql_select_db(stats);


$link2 = mysql_connect("ip here user pass")
or die("Could not connect: " . mysql_error());
mysql_select_db(orders);

is there anyway to keep both connections open and running so I can call variables defined in both DB's.

is this even possible?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-07-04, 09:58 PM
rec0n rec0n is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Earth
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
$dbc_1 = mysql_connect(...);
$dbc_2 = mysql_connect(...);
mysql_select_db('db1', $dbc_1);
mysql_select_db('db2', $dbc_2);
$query = mysql_query(..., $dbc_1);
$query = mysql_query(..., $dbc_2);
__________________
-- my bad lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-07-04, 10:27 PM
JoJo26 JoJo26 is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for the help, greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
insert data to multiple tables ! puppy PHP 4 06-02-04 11:40 AM
login with db check using cases digital4twenty ASP 2 05-13-04 08:35 AM
Sending multiple mails thru outlook loony_1313 Windows .NET Programming 0 04-17-04 04:01 PM
free webmail client that can handle multiple pop accounts? blasto333 Script Requests 1 04-14-04 12:17 PM
Mail Script sending multiple times when Table has a lot of data dsumpter PHP 12 07-16-03 06:17 PM


All times are GMT -5. The time now is 01:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.