I use to use sqlsrv_connect but changed it to PDO.
Now i got this syntax error when using åäö.
When i used sqlsrv_connect i could do this:
SELECT Order, [Benämning], [Vår ref] FROM table
and it worked.
Now i'm trying to figure out how to do it with PDO.
So i tried:
SELECT Order, [Benämning], Antal FROM table
And got this error:
Operand type clash: text is incompatible with float
And i tried:
SELECT Order, Benämning, Antal FROM table
And i got error:
Incorrect syntax near '�'.
In the connection i added utf8:
$sql = new PDO("odbc:Driver=$driver;server=$serverName,$port;Database=$database;ConnectionPooling=0", $uid, $pwd,
array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
)
);
Now, when pasting this i can se: PDO::MYSQL_ATTR_I... I'm connecting to SQL.. not MYSQL. Can this be the problem?
If i remove the "Benämning" column and just select columns without åäö or space the select works just fine.
UPDATE
I got åäö to work with sqlsrv instead of odbc.