我用的是PHP5 + SQL Server做的一个测试数据库连接的东东,代码如下:
<?php
mssql_connect('zhousq',sa,sa) or die ("不能连接到SQL Server");
echo "数据库连接成功!<br>";
?>
(不知道这样写的有没有错误,我是菜鸟刚学不久!)
运行它老提示:
Fatal error: Call to undefined function mssql_connect()
不知道是什么原因,望解答!
 
另外,我已经把.ini里的extension=php_mssql.dll前面的分号去掉了,在PHP5里也复制了一份.ini文件,不知道问题出在哪?

解决方案 »

  1.   

    php_mssql.dll文件拷贝到system32中
      

  2.   

    mssql_connect('zhousq',sa,sa) or die ("不能连接到SQL Server");
    ~~~~~~~~~~~~~有这个函数么?
    -->msql_connect
      

  3.   

    http://cn.php.net/manual/zh/ref.mssql.php注意看这个扩展的安装需要需求
    Requirements for Win32 platforms. The extension requires the MS SQL Client Tools to be installed on the system where PHP is installed. The Client Tools can be installed from the MS SQL Server CD or by copying ntwdblib.dll from \winnt\system32 on the server to \winnt\system32 on the PHP box. Copying ntwdblib.dll will only provide access. Configuration of the client will require installation of all the tools. Requirements for Unix/Linux platforms. To use the MSSQL extension on Unix/Linux, you first need to build and install the FreeTDS library. Source code and installation instructions are available at the FreeTDS home page: http://www.freetds.org/ 注意: In Windows, the DBLIB from Microsoft is used. Functions that return a column name are based on the dbcolname() function in DBLIB. DBLIB was developed for SQL Server 6.x where the max identifier length is 30. For this reason, the maximum column length is 30 characters. On platforms where FreeTDS is used (Linux), this is not a problem. 
      

  4.   

    php.ini 里的
    ;extension=php_mssql.dll 
    把分号去了吗?
      

  5.   

    去掉分号 - 拷贝文件 - 重启IIS(Apache)