Home > Backend Development > PHP Problem > How to get text field in php

How to get text field in php

(*-*)浩
Release: 2023-02-25 16:56:01
Original
2718 people have browsed it

When PHP queries the content of the text field of the MSSQL database, if the content is too long, part of the content will be intercepted. This may not be the result we want. Solution:

How to get text field in php

1. Modify the php.ini file

Open the php.ini file and search for mssql.textlimit. You can find the following content: (Recommended learning: PHP video tutorial)

;Valid range 0 - 2147483647. Default = 4096.
;mssql.textlimit = 4096
; Valid range 0 - 2147483647. Default = 4096.
;mssql.textsize = 4096
Copy after login

Put mssql.textlimit = 4096 and mssql.textsize = 4096 Remove the semicolon in front of the two lines, change the value to a larger value, and restart the service.

2. Set through ini_set

The above is the solution when you have server management permissions. Maybe sometimes we don't have server management rights, so we can only set it up on the program.

@ini_set( mssql.textsize , 200000) ;
Copy after login

Add this sentence to complete the setting.

3. Solve the problem by executing SQL statements

For example: mssql_query ('SET TEXTSIZE 65536', $myConn);

where , $myConn is the data connection identifier. This is a relatively primitive way of writing. What it means is to execute a SQL statement like 'SET TEXTSIZE 65536'.

Note: If the field type is ntext, sometimes garbled characters will appear, which looks like the content has been intercepted abnormally. In this case, the content can be converted into text type in the SQL statement, written as follows:

select id,convert(text,content) as content from news
Copy after login

The above is the detailed content of How to get text field in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template