欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

PHP如何与 MSSQL连接

程序员文章站 2022-06-04 22:05:23
...

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);