/* BeejBløg */

Apr 23, 2016 - 1 minute read - Comments -

SQL Server PDO PHP7

  1. get the DLL – grab latest x64.zip

    1. add to your php.ini extension list: [ExtensionList] extension=php_pdo_sqlsrv_7_nts.dll

    2. here’s sample call code: <?php

      try {

       $conn = new PDO( "sqlsrv:Server= ip_address; Database = mydb ", $user, $pwd);
       $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
      

      } catch(Exception $e){

       die(var_dump($e));
      

      }

      $stmt = $conn->query($qry); $result = $stmt->fetchAll(); $row = $result[0]; $colval = $row[“fieldname”]; ?>