Thursday, 15 August 2013

sql server - Connecting MSSQL Database Using PHP PDO Objects -


I am trying to connect to the MSSQL database server using the PSDO object:

 < Code> $ dsn = 'mssql: host = *** *** *** ***; Dbname = *** ... '; $ User name = '***'; $ Password = '***'; Try {$ Backlength = New PDO ($ DSN, $ username, $ passwd); $ Baglanti- & gt; SetAttribute (PDO :: ATTR_ERRMODE, PDO :: ERRMODE_EXCEPTION); $ Bugatti-> Edge ("SET NAMES UTF8"); Ini_set ('max_execution_time', 2000000); } Hold (PDOException $ e) {echo $ e-> GetMessage (); }  

I get this error after this coding:

  SQLSTATE [HY000]: General error: 10007 'NAMES' is a recognized SET option is not. [10007] (Severity 5)  

How can I do this issue?

Thank you

mssql STT name UTF8 < / P>

:

  $ pdo = new PDO ('dblib: host = localhost; dbname = databasename; charset = UTF-8', 'user Name ',' password ');  

or

  $ pdo = new PDO ('mysql: host = hostname; dbname = defaultDbName', 'username', 'password', array (PDO :: MYSQL_ATTR_INIT_COMMAND = & gt; "SET NAMES utf8"));  

No comments:

Post a Comment