Jump to content

connection to an outside db


levidyllan

Recommended Posts

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 ?

 

 

Link to comment
https://forums.phpfreaks.com/topic/65433-connection-to-an-outside-db/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.