n1concepts Posted October 4, 2010 Share Posted October 4, 2010 Does anyone have an example of establishing two MySQL connections (one local & one external) to pass data from local DB to external using PHP? Objective: I need to query the table of local data (for email addresses) then the same for external db table and if email not present, insert into that db. I will use CRON to run the script (will figure that part out later but suggestions welcome if you have that info as well....) Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted October 4, 2010 Share Posted October 4, 2010 $link1 = mysql_connect('server1', 'user1', 'pass1'); $link2 = mysql_connect('server2', 'user2', 'pass2'); Then specify $link1 or $link2 as you use mysql functions. Quote Link to comment Share on other sites More sharing options...
n1concepts Posted October 4, 2010 Author Share Posted October 4, 2010 Got it! One last question: as long as I close both connection at the end of each query and insertion, there should be any load problems (CPU related) right? I ask b/c it will be firing afew thousand each hour (simply query then inserts) but just curious if this could present problems long term as it will run indefinitely (using a CRON to fire every three to five minutes). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.