Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.