加入3个表来显示PHP-MSSQL的某些数据

so i have this tables and i want to get certain datas for user to view and be able to POST to other page

i cant post images so i have to break this down so please bear with me

1st table

  • dbo.users
  • pkey(UserID)
  • EmployeeName

2nd table

  • dbo.PC
  • pkey(PCID)
  • PC_Number

3rd table

  • dbo.FA_PC
  • pkey(FAID)
  • fkey(UserID)
  • fkey(PCID)

how could i display the PC_Number of the currently selected $rs->Fields('UserID') in the same form and still be able to post it on printd.php

i dont know how to connect the dbo.users->dbo.FA_PC->dbo.PC

<form action="printd.php" method="post" target="_blank">
<?php
ini_set("display_errors","on");
$conn = new COM("ADODB.Connection");
   try {
   $myServer = "WTCPHFILESRV\WTCPHINV";
   $myUser = "sa";
   $myPass = "P@ssw0rd";
   $myDB = "wtcphitinventory";   
   $connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
   $conn->open($connStr); 
         if (! $conn) {
            throw new Exception("Could not connect!");
        }
   }
   catch (Exception $e) {
      echo "Error (File:): ".$e->getMessage()."<br>";
   }

if (!$conn)
  {exit("Connection Failed: " . $conn);}

    $sql_exp = "select * from dbo.users"; 

  $rs = $conn->Execute($sql_exp);
echo "<select name='empt'>";
   while (!$rs->EOF) {
       set_time_limit(0);
        echo "<option value=".$rs->Fields('UserID')." >".$rs->Fields('EmployeeName')."</option>";

      $rs->MoveNext();
   }       
   $rs->Close();   



       ?>

the join will look like this,

SELECT  a.*, c.PC_Number
FROM    users a
        INNER JOIN FA_PC b
            ON a.UserID = b.UserID
        INNER JOIN PC c
            ON b.PCID = c.PCID

To fully gain knowledge about joins, kindly visit the link below: