Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Its not possible, the only way its possible on PHP would be when your using clusters / several nodes with a replication setup.</p> <p>Obviously you don't understand some of the more technical stuff in regards to mysql, but give this ago.</p> <pre><code>$master = mysql_connect("master_host","abc","abcdb"); $slave = mysql_connect("slave_host","xyz","xyzdb"); if(mysql_select_db("abc_db",$master) &amp;&amp; mysql_select_db("xyz_db",$slave)) { //Both Selected $sql = mysql_query("SELECT * FROM employee",$master); $rows = array(); while($row = mysql_fetch_assoc($sql)) { //Query the other $slave DB here! $slave_sql = mysql_query("SELECT * FROM department WHERE department_id = " . $row['id'],$slave); while($sub_row = mysql_fetch_assoc($slave_sql)) { $row = array_combine($sub_row,$row); } $rows[] = $row; } } </code></pre> <p>But thats not what you want to be doing really.</p> <p>Just incase your trying to join across 2 <em>databases</em> on the same server, as both your hosts in your code are <em>locahost</em>, this is possible</p> <pre><code>SELECT * FROM db1.employees db1_e,db2.records db2_r WHERE db1_e.employee_id = db2_r.record_eid </code></pre> <p>But not sever 1 to an external server without using replication, even then you can replication wont be much help.</p> <p>References and links:</p> <p><a href="http://nathan.rambeck.org/blog/2-joining-mysql-tables-across-multiple-databases" rel="nofollow noreferrer">http://nathan.rambeck.org/blog/2-joining-mysql-tables-across-multiple-databases</a></p> <p><a href="http://dev.mysql.com/doc/refman/5.0/en/replication.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/replication.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload