levidyllan Posted August 17, 2007 Share Posted August 17, 2007 I was asked this question today and well thought I woud research it. Can we connect to a database(mySQL) using php, on another site. IE: siteOne.co.uk runs some script that can connect to siteTwo.co.uk mysql database, therefore looking as its got is own etc? Any ideas or a straight NO. I did mention about running a php to xml page that reads the db and converts it to an xml page and then it can get the data from there with absolute path etc ? Quote Link to comment https://forums.phpfreaks.com/topic/65433-connection-to-an-outside-db/ Share on other sites More sharing options...
lemmin Posted August 17, 2007 Share Posted August 17, 2007 Yes, this is possible. You just put in the correct cridentials to connect to it. Quote Link to comment https://forums.phpfreaks.com/topic/65433-connection-to-an-outside-db/#findComment-326774 Share on other sites More sharing options...
wildteen88 Posted August 17, 2007 Share Posted August 17, 2007 Yes PHP can connect to remote databases. You'd do this: $conn = mysql_connect('siteTwo.co.uk', 'username', 'password'); mysql_select_db('database'); Just make sure the database on siteTwo.co.uk allows for remote connections from siteOne.co.uk. Quote Link to comment https://forums.phpfreaks.com/topic/65433-connection-to-an-outside-db/#findComment-326894 Share on other sites More sharing options...
levidyllan Posted August 18, 2007 Author Share Posted August 18, 2007 cheers Wildteen88, wil give it a try:-) Quote Link to comment https://forums.phpfreaks.com/topic/65433-connection-to-an-outside-db/#findComment-327393 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.