我已成功連接到MSSQL數據庫,並試圖將數據從數據庫導入到HTML表單的下拉框中。我將如何通過SQL查詢將數據庫數據導入到該下拉列表中?我的表名是Stage_One,我想從表中拉場MR_Name將SQL Server數據導入HTML下拉框
這是我的聯繫信息...
<?php
$serverName = "xxxxxxxxxx";
$uid = "xxxx";
$pwd = "xxxxxxxxxxx";
$databaseName = "Stage";
$connectionInfo = array("UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn)
{
echo "Statement executed.<br>\n";
}
else
{
echo "Error in statement execution.\n";
die(print_r(sqlsrv_errors(), true));
}
?>
這是我爲我的HTML代碼下拉...
<section class="desc-block-left0">
<div align="center">
<div id="vendor">
<strong>Vendor:</strong>
</div>
<select name="vendor_dropdown">
<option value=""></option>
</select>
</div>
</section>
你張貼了這個已經http://stackoverflow.com/questions/39641798/import-mssql-data-into-html-dropdown - 請不要轉貼。 –