0
votes

I am using PHP 5.5 and ODBC installed and active but still I have that error I couldn't connect the server. I Guess I need odbc driver name.

$conn = "DRIVER={SQL Server};SERVER=$server;DATABASE=$db"; 

Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in

1

1 Answers

0
votes

You can be using PDO to connect. If you are on windows:

$this->stmt = new PDO ("sqlsrv:server=$server;Database=$database;",$user,$pass);

On Linux:

$this->stmt = new PDO ("dblib:host=$server;dbname=$database;charset=UTF-8;",$user,$pass);