我是 sql server 的新手。我有使用 MySQL 的应用程序,现在我想在该应用程序中使用 sql server 而不是 MySQL。我的PHP是:
<?php
$myServer = "localhost";
$myUser = "";
$myPass = "";
$myDB = "UNIVERSITY";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT clgname";
$query .= "FROM dbo.clg ";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
if($numRows==0){
echo "false";
}
else{
echo "true";
}
//close the connection
mssql_close($dbhandle);
?>
我还删除了之前的分号
extension=php_mssql.dll
但我看到错误:
Fatal error: Call to undefined function mssql_connect() in C:\xampp\htdocs\1.php on line 8
请帮忙。谢谢。