mssql适用于php版本<7,php版本在7以上的可以选择使用pdo,当然必须安装pdo_sqlsrv扩展才能使用。
SELECT
ini_set('mssql.charset', 'UTF-8');
$conn = mssql_connect(HOST, USER, PWD) or die ("connect failed");
mssql_select_db(DB, $conn);
$sql = "SELECT * from sheet_detail where sheet_no = '{$sheet_no}';";
$row = mssql_query($sql, $conn);
$PurchaseOrderItemsArr = array();
while ($list = mssql_fetch_array($row)) {
$PurchaseOrderItemsArr[] = array('barCode' => $list['item_no']),
'productBatch' => '', 'expireDate' => '');
}
mssql_close($conn);
INSERT、UPDATE、DELETE
ini_set('mssql.charset', 'UTF-8');
$conn = mssql_connect(HOST, USER, PWD) or die ("connect failed");
mssql_select_db(DB, $conn);
$sql = "";
mssql_query($sql, $conn);
$result = mssql_rows_affected($conn);//执行结果
mssql_close($conn);