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.php 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,<port>';
$server = 'DIVINE-2953FF11SQLEXPRESS';
$db='<database>';
$dbuser = '<username>';
$dbpass = '<password>';
$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);
补充:数据库,Mssql