<?php
ini_set("display_errors","on");
$conn = new COM("ADODB.Connection");
try {
$myServer = "WTCPHFILESRV\WTCPHINV";
$myUser = "sa";
$myPass = "P@ssw0rd";
$myDB = "wtcphitinventory";
$connStr = "...conn string...";
$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.PC";
$rs = $conn->Execute($sql_exp);
echo "<table><tr><th>Desktop Number</th></th></tr>";
while (!$rs->EOF) {
set_time_limit(0);
echo "<td>CP # <br>".$rs->Fields("PC_Number")."</td>";
$rs->MoveNext();
}
echo "</table>";
$rs->Close();
?>
我想要一个列表框,而不仅仅是打印数据库中 PC_Number 的所有数据。我所能做的就是回应它,我很难插入一个选择。我想要一个表单方法和一个 select(listbox)