php连接ms sql server的简单示例
2018-07-20 来源:open-open
/*
** 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);
标签: Mysql
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
最新资讯
热门推荐