Php + mssql makes it really painful. The type of ntext fields used to read mssql in php has another problem: when the content of ntext is too long, the ntext fields are not completely read.
I have been searching for it on the Internet for a long time. It is said that ntext reading in php is incorrect, but I was depressed if I didn't find my page error. Later I found out that php can only read 4 kB of content by default. It turns out that my content exceeds 4 kB. The modification method is as follows:
1. Upgrade php to php5.
Fortunately, I already have php5.
2. Adjust the parameters of php. ini to increase the default value of php to 4 K.
; Valid range 0-2147483647. Default = 4096.
; Mssql. textlimit = 4096
; Valid range 0-2147483647. Default = 4096.
; Mssql. textsize = 20480
";" Before mssql. textlimit and mssql. textsize, and then change the default value to a larger value, such as 20480 (20 K)
3. Restart the web server.
I thought the exciting time would come. When I run the php page, the effect was still the same as before, and the field data was not completely read. Later, I found out that php is not very friendly with ntext support and should be converted to text. So we use
Convert (text, content) is switched, without any effect, and I almost killed my iis. I have been searching for it online for a long time. When I was about to give up, I tried to change the database connection method. I put
The change of odbc_connect to mssql_connect succeeded.
It seems that mssql in php is better than mssql_connect. However, php is perfect when combined with mysql.