SQL Server Query from PHP

I searched for this topic but did not find any solution; there was a similar question, but it was not resolved: Working with accented characters in sql query and table name

I am working with a database on SQL Server 2005 that uses Modern_Spanish_CI_AS as a sort. I am developing a web interface using PHP and I have a problem with accent.

There is a table (say, "Objetos") whose fields are: ID Name Descripción

I cannot query this table due to accent. If I build my query "Select a.ID, a.Name FROM Objetos" , it works fine, but if it "Select a.ID, a.Descripción FROM Objetos" to "Select a.ID, a.Descripción FROM Objetos" , it returns zero rows.

I can’t change the sorting of the database, so I decrypted the queries before sending them $ssql = utf8_decode($ssql); ... Strange, using this workaround, I can do INSERT , but can not SELECT .

Any ideas? Thanks

+6
source share
1 answer

Try to surround the column with the symbol ``. If this does not work, try removing "a". prefix on the name of the column.

+1
source

All Articles