View Full Version : PHP, ODBC, and Unicode compatibilities...

10-10-2003, 07:58 AM
I have a MSSQL Server that I am accessing and I have come up with some errors. I actually have come up with some solutions too, but I'm not sure how to handle them.

When running a simple query in PHP to the db (mssql_query (SELECT * FROM dbtable); ) I get the error "mssql_query(): message: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16)."

I have done some research on this and from what I understand, I am using DBLIB or some older ODBC version that doesn't support Unicode. The only answer I have gotten so far is "You need to check your data access API from PHP, it's configuration etc." That would be nice if I knew what that meant. Is anyone familiar with this or how to remedy the problem? Might there be a way to get around the Unicode thing or have I run into a necessary upgrade?


10-10-2003, 12:50 PM
My guess is this is an issue of microsoft not playing well with others.

Ever consider using a different database server?

10-10-2003, 12:57 PM
Actually, Chris, this is a job for work. I work for DoD so MSSQL is the only db server that is approved. I really should be using ASP and .Net stuff, but PHP is more universal and will allow me to correlate what I do at work and my personal website (besides the MSSQL thing). I think the language is far less convoluted too...let me know if you find anything, and in the meantime I will continue to bang my head against the wall!!!

10-10-2003, 02:28 PM
I really don't have any experience with using PHP with MS SQL, sorry I can't help.

Try here:


10-14-2003, 09:27 AM
I haven't found a way to update MS's ODBC junk...even Server 2003 Enterprise has only version 3.6. The key was to check the field types of the existing DB that I was testing on. I had a "remarks" field that called for ntext data. The best bet in the situation that I came up with is to make the data fields strictly ANSI rather than trying to make both the server and client unicode-compatible. I changed the ntext field to text and I am returning a bunch of crap...but no PHP errors. Sorry to confuse everyone...