Php connection mssqlnvarchar and text are truncated solution

Source: Internet
Author: User
When connecting to mssql in php, I suddenly found that nvarchar was intercepted as 255, and the data was lost and text was intercepted. The following describes the solution in the manual. nvarchar is intercepted as 255 solution: PHP sets nv... when connecting to mssql in php, I suddenly found that nvarchar was intercepted as 255, and the data was lost and text was intercepted. The following describes the solution in the manual.

Nvarchar is intercepted as 255. solution:

PHP has processed nvarchar according to MySQL's varchar. the code is as follows:

Select cast (Target Field as text) from table name

If the summary field in your article table is nvarchar, run the following command:

Select cast (summary as text) from article

In another case, the text segment is intercepted:

MSSQL section of PHP configuration file php. ini:

[MSSQL]; Valid range 0-2147483647. Default = 4096. mssql. textlimit = 4096 // open source code phprm.com; Valid range 0-2147483647. Default = 4096. mssql. textsize = 4096

See the two configuration parameters:

; Valid range 0-2147483647. Default = 4096.

Mssql. textlimit = 4096

; Valid range 0-2147483647. Default = 4096.

Mssql. textsize = 4096

I believe you now know the key to the problem. you only need to increase the two values. However, you must also consider the following:

; Maximum size of POST data that PHP will accept.

Post_max_size = 2 M

Set according to the actual situation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.