你可以用一下通过odbc连接sqlserver
连接数据库的函数也用php的odbc连接函数

解决方案 »

  1.   

    在php.ini中~
    你有没有打开extension=php_mssql.dll的mssql的支持啊??
      

  2.   

    mssql_select_db("$mydb",$link);
    中的"$mydb"不用加""~
      

  3.   

    odbc_connect(string dsn, string user, string password, int [cursor_type]);本函式用来连结到 ODBC 资料库,传回值为连结的代号 ID 值。参数 dsn 为资料来源名称 (Data Sources Name)。参数 user 及 password 分别为连结的帐号及密码。参数 cursor_type 通常省略,其值有 SQL_CUR_USE_IF_NEEDED、SQL_CUR_USE_ODBC、SQL_CUR_USE_DRIVER 及 SQL_CUR_DEFAULT 等四种。当使用复杂的资料存取时可能会有类似 "Cannot open a cursor on a stored procedure that has anything other than a single select statement in it" 的错误讯息字串,此时若将参数 cursor_type 的值设为 SQL_CUR_USE_ODBC 就可以避开了。odbc_exec(int connection_id, string query);本函式用来执行 SQL 的 query 指令。参数connection_id 为 ODBC 连结代号 ID 值。参数 query 则为欲执行的指令。传回值为 Result ID 值。
    具体的
    <?php
    $conn = odbc_connect("WebDB", "", "");
    $query = "select user, idno ";
    $query .= "from userinfo";
    $result_id = odbc_do($conn, $query);
    while(odbc_fatch_row($result_id)) {
      $user = odbc_result($result_id, 1);
      $idno = odbc_result($result_id, 2);
      echo $user."的身份证字号为".$idno."<br>\n";
    }
    odbc_close($conn);
    ?> 
      

  4.   

    搜索php目录是否有php_mssql.dll修改php.ini中的extension_dir指向dll所在目录
    去掉extension=php_mssql.dll前面的分号
      

  5.   

    照着RobinCat(刀是一场无涯的梦) 的做吧
      

  6.   

    $link=mssql_connect("local",$LoginID,$Password); 
    是不是这样哟,SQL SERVER 默认的是这个名字吧