mysql - PHP Login with another server database? -


how login sever database , list content database ?

what required settings that?

with pdo, can connect 2 different databases/servers in same script.

<?php $db1 = new pdo('mysql:host='.db_host.';dbname='.db_database.';charset=utf8', db_user, db_pass); $db2 = new pdo('mysql:host='.db_host2.';dbname='.db_database2.';charset=utf8', db_user2, db_pass2);  //select database 1       $results = $db1->query("select * table");  //select database 2 $results2 = $db2->query("select * another_table"); 

if want connect server outside of localhost - remember open firewall , add server's ip access hosts.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -