我收到此错误:在第20行的脚本中调用未定义的函数mssql_connect()。有什么想法吗?再次感谢!
代码:
$ serverName =“ * ”;;
$ uid =“ * ”;;
$ pwd =“ * ”;
$ databaseName =“ ** ”;
$connectionInfo = array( "User"=>$uid,
"Password"=>$pwd,
"Database"=>$databaseName);
/* Connect using SQL Server Authentication. */
$conn = mssql_connect($serverName, $connectionInfo);
$tsql = "SELECT FirstName, LastName, EmailAddr FROM Customer";
/* Execute the query. */
$stmt = mssql_query($conn, $tsql);
if ($stmt)
{
while($row = mysql_fetch_array( $stmt, MSSQL_FETCH_ASSOC))
{
$FirstName = $row["FirstName"];
$LastName = $row["LastName"];
$EmailAddr = $row["EmailAddr"];
echo "$FirstName";
echo "$LastName";
echo "$EmailAddr";
}
}
else
{
echo "Submission unsuccessful.";
die(print_r( mssql_errors(), true));
}
/* Free statement and connection resources. */
mssql_free_stmt($stmt);
mssql_close($conn);
答案 0 :(得分:1)
获得配置,您必须启动PHP_Extension
“php_mssql”
如果是wamp得到了wamp - > php - > PHP扩展 - > php_mssql
另外php_pdo_mssql
答案 1 :(得分:0)
您没有安装mssql扩展程序。此外,您也可以使用mssql_query
和mysql_fetch_array
。这里有点不对劲:))
答案 2 :(得分:0)
生成此错误是因为您尚未从php.ini文件中打开MicroSoft SQL Server ddl文件。
要使其可用,请按照以下步骤操作
1)打开php.ini文件 2)搜索; extension = php_mssql.dll 3)通过删除&#34 ;;"取消注释。第一 4)重新启动服务器
此致