Home  >  Article  >  Backend Development  >  PHP uses sql database to get field problems introduction_PHP tutorial

PHP uses sql database to get field problems introduction_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:59:04625browse

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!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328178.htmlTechArticleDuring the development process of PB, due to the use of ntext fields in the database, the following error message appeared, which made me depressed for a long time. I couldn't find the solution, and after consulting a lot of information, I finally understood: PB report...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn