相关疑难解决方法(0)

用于Windows的PHP 7.0 ODBC驱动程序

我将PHP 5.6.30(https://www.apachefriends.org/de/download.html)升级到PHP 7.0(https://bitnami.com/stack/wamp/installer)

到目前为止,一切都运行良好,当我使用MySQL数据库时,它将我的页面的加载时间从1,2秒减少到约300毫秒.但是现在我正在尝试使用以下简单脚本连接到MSSQL数据库,这对我的旧安装(PHP 5.6)工作正常:

<?php
    //Use the machine name and instance if multiple instances are used
    $server = 'Server-Adress';
    $user = '';
    $pass = '';
    //Define Port
    $port='Port=1433';
    $database = 'Databasename';

    $connection_string = "DRIVER={SQL Server};SERVER=$server;$port;DATABASE=$database";
    $conn = odbc_connect($connection_string,$user,$pass);
    if ($conn) {
        echo "Connection established.";
    } else{
        die("Connection could not be established.");
    }

    $sql = "SELECT * FROM st3_200 WHERE identifier = 1";

    $result = odbc_exec($conn,$sql);
    // Get Data From Result
      while ($data[] = odbc_fetch_array($result));

      // …
Run Code Online (Sandbox Code Playgroud)

php windows sql-server odbc php-7

4
推荐指数
3
解决办法
5万
查看次数

标签 统计

odbc ×1

php ×1

php-7 ×1

sql-server ×1

windows ×1