Dear Friends!
   
  I have got two databases on two different PCs, A & B. 
   
  When i was developing the software, i locally copied the tables from PC B to 
PC A.
   
  Since the tables in PC-B are updating regularly so now i need to call these 
tables from PC-B to PC-A, without locally copying them.
   
   
  The database on PC-A is named as "tac"
  The database on PC-B is named as "Inventory"
   
  and using both databases i am trying to execute an INNER JOIN SELECT query, 
like the same way i used to execute when i had the local copy of tables from 
Inventory.
   
  Problem:- Now when i call the second 'mysql_select_db', function, the query 
failed to recognize the tables of the first database connection.
   
  Below is the actual code:
   
   
   
   
  <?php
   
  ///////// connection establishment with first database /////////////
   
  $dbhost1 = '192.168.1.11';
$dbuser1 = 'usman';
$dbpass1 = 'ti123';
$dbname1 = 'Inventory';
  $conn1 = mysql_connect($dbhost1, $dbuser1, $dbpass1); 
mysql_select_db($dbname1, $conn1);
  
 
  ////////// connection establishment with second database 
///////////////////////
   
  $dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'acbl';
$dbname = 'tac';
  $conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $conn);
  
 
  ///////////////// i want to exectue this query, using both databases but it 
fail to recognize the
  ////////////////  Inventory database tables 
   
   $sql = "SELECT tac.casemain.CaseID, tac.casemain.BranchID from tac.casemain 
INNER JOIN Inventory.branch ON tac.casemain.BranchID = 
Inventory.branch.branch_code";
   
   
  $result=mysql_query($sql, $conn) or die("cannot execute the query " . 
mysql_error());
$num=mysql_num_rows($result);
  echo "No: $num";
  ?>


       
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, 
when. 

[Non-text portions of this message have been removed]

Reply via email to