hello i'm beginner at programming and i want to connec to my database with PHP PDO with SQL SERVER 2008 R2
the problem at the begining it appears to me an error with this message "could not find driver" after a little searching about this i found how to download & install the drivers i installed them and added on php.ini but when i want to activate from the wamp i did not find the driver
and this is my code

<?php
 try {
    $hostname = "********;
    $port = *****;
    $dbname = "****";
    $username = "*****";
    $pw = "******";
    $db_connect = new PDO ('dblib:host=$hostname;dbname=$dbname',$username,$pw);
  } catch (PDOException $e) {
    echo "Failed to get DB handle: " . $e->getMessage() . "\n";
    exit;
  }
?>

thanks for help

Member Avatar for diafol

You need to stop and restart Apache after making changes to php.ini

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.