Home > Article > Backend Development > PHP uses sql database to get field problems introduction_PHP tutorial
During the PB development process, due to the use of ntext fields in the database, the following error message appeared. I was depressed for a long time and could not find a solution. After consulting a lot of information, finally understood:
PB error: Unable to use DB-Library (such as ISQL) or ODBC 3.7 or earlier to send ntext data or Unicode data using only Unicode collation to the client.
————————————————
Since ntext and nvarchar fields in SQL Server use Unicode encoding to store content, PHP reads ntext and nvarchar through mssql extension An error will occur when entering type fields.
If the title field type is nvarchar and the content field type is ntext, then the following SQL statement will report an error:
select title,content from article
The correct way to write it is:
select convert(varchar(255),title) as title, convert(text,content) as content from article
or Do not use ntext field
This is very useful and solves my problem!