php連接ms sql server的簡單示例
/ ** Connect to database:/// Connect to the database (host, username, password) $con = mssql_connect('localhost','admin','foo') or die('Could not connect to the server!');
// Select a database: mssql_select_db('Northwind') or die('Could not select a database.');
// Example query: (TOP 10 equal LIMIT 0,10 in MySQL) $SQL = "SELECT TOP 10 * FROM ExampleTable ORDER BY ID ASC";
// Execute query: $result = mssql_query($SQL) or die('A error occured: ' . mysql_error());
// Get result count: $Count = mssql_num_rows($result); print "Showing $count rows:<hr/>\n\n";
// Fetch rows: while ($Row = mssql_fetch_assoc($result)) {
print $Row['Fieldname'] . "\n";
}
mssql_close($con);</pre>
本文由用戶 cf46d 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!