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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -