Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Connecting to MSSQL 2005 with php PDO
  2. $host = 'NEW';
  3. $user = 'sa';
  4. $pass = 'mypass';
  5. $dbname = 'mydb';
  6.  
  7. try {
  8.  
  9.   $DBH = new PDO("sqlsrv:Server=$host;Database=$dbname", $user, $pass);
  10. }
  11. catch(PDOException $e) {
  12.     echo $e->getMessage();
  13. }
  14.        
  15. SQLSTATE[IMSSP]: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712