I am having issues in installing MSSQL in my php library.
I am getting below error
Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\img\test.php:7 Stack trace: #0 C:\xampp\htdocs\img\test.php(7): PDO->__construct('sqlsrv:server=D...', '', '') #1 {main} thrown in C:\xampp\htdocs\img\test.php on line 7
I have added below dll files as per the R&D but still I am not able to run mssql. I am working with my local system and installed SQL server 2012 and MS SQL manager I have created a database name THL with sone table I added server name (local)\sqlexpress but it did'nt worked so I changed it to DESKTOP-DDOS0G1\sqlexpress still it is not working.
My connection code is below
<?php
$serverName = 'DESKTOP-DDOS0G1\sqlexpress';
$conn = new PDO("sqlsrv:server=$serverName ; Database=DHL", "", "");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
if(!$conn) {
echo 'Something went wrong while connecting to MSSQL';
die(print_r(sqlsrv_errors(),true));
}else
{
echo 'connected';
}
?>
Please suggest what things I have missed in this process. I have also installed ODBC.
