Home  >  Article  >  Database  >  PHP如何与 MSSQL连接

PHP如何与 MSSQL连接

WBOY
WBOYOriginal
2016-06-07 17:47:02979browse

PHP如何与 MSSQL连接

PHP如何与 MSSQL连接

在PHP wadhwahitesh的Windows,MS SQL Server的,PHP脚本语言,PHP和
标签:PHP中,MSSQL,WAMP的
我已经成功连接的mssql使用PHP,但是我得到下列警告和系统死亡。请让我知道这个问题尽快解决。谢谢

Warning: mssql_query(): supplied argument is not a valid MS SQL-Link resource in C:wampwwwtestsql2005index. on line 11
Warning: mssql_fetch_array(): supplied argument is not a valid MS SQL-result resource in C:wampwwwtestsql2005index.php on line 12

Line 11 : $qry = mssql_query($sql1,$dblink);
Line 12 : while ($row = mssql_fetch_array($qry)){

$server = 'DIVINE-2953FF11,';
$server = 'DIVINE-2953FF11SQLEXPRESS';
$db='';
$dbuser = '';
$dbpass = '';
 
$link = mssql_connect($server, $dbuser, $dbpass) or die("cannot connect to server");
$dblink = mssql_select_db($db, $link) or die("cannot connect to database");
$sql1 = "SELECT firstname FROM dbo.persons";
$qry = mssql_query($sql1,$dblink);
while ($row = mssql_fetch_array($qry)){
    echo $row["FirstName"];
}
mssql_close($link);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn