0

I have to code an application on my server that triggers emails based on info that come from a database hosted on another server and I don't know how to query that information. I'm using PHP/MySQL. I can't established a connection to this database like I do normally (when database is host on the same server that the application file), right?

Thanks in advance,

0

3 Answers 3

5

Wrong, there is no difference whether code and database are on the same or different servers. As long as the remote db server is configured to allow conections from foreign hosts that is... But that's a hosting issue not a programming one.

Sign up to request clarification or add additional context in comments.

1 Comment

You're right, I just add my host in the Remote Database Access Hosts and voilà!
3

I'm not really sure why you wouldn't be able to. I've hosted databases on servers other than my hosting server before.

Try this

$my_db = mysql_connect('yourdb.com:3307', 'myuser', 'mypassword');
    if (!$my_db) die('This might be a problem: ' . mysql_error());

Comments

1

If mysql is on another machine , from mysql, you have to give permission for outsider.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.