所以我有这些表格,我希望获得某些数据供用户查看并能够发布到其他页面
我无法发布图片所以我必须将其分解,所以请耐心等待我
第一桌
第二桌
第3桌
如何以相同的形式显示当前所选的$ rs->字段('UserID')的PC_Number,并且仍然可以在printd.php上发布
我不知道如何连接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();
?>
答案 0 :(得分:2)
联接看起来像这样,
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
要充分了解联接知识,请访问以下链接: