可能重复:
加入 3 个表以显示某些数据 PHP-MSSQL
我有这些表,我想获取某些数据供用户查看并能够发布到其他页面
我不能发布图片,所以我必须分解它,所以请多多包涵
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)
<?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='empf'>";
while (!$rs->EOF) {
set_time_limit(0);
echo "<option value=".$rs->Fields('UserID')." >".$rs->Fields('EmployeeName')."</option>";
$rs->MoveNext();
}
$rs->Close();
?>
我怎样才能以相同的形式显示PC_Number
当前选择的内容$rs->Fields('UserID')
,并且仍然能够将其发布在 printd.php 上