PHP and MS SQL <Long Text> cuts off

Posted on 2004-10-20
Last Modified: 2012-06-22
OK here's the situation,

- I'm working with PHP and Microsoft SQL
- I'm trying to display a press release on a page
- Title, abstract, date, all displays well
- The body of the press release gets cut off at the bottom

Is there a limit on the number of characters PHP can handle from MSSQL?
How do I get around this?

Question by:netele
  • 3
  • 2

Accepted Solution

ewong_111 earned 500 total points
ID: 12366399
make sure in the configuration file php.ini
mssql.textlimit is set to a larger value.. the limit is 0 - 2147483647 and the default should be 4096
or you can use the run time function init_set(string varname, string newvalue) to set it before you query the text value from the database
hope this helps

Expert Comment

ID: 12366502
in addition.. in case your mssql extension is not on.. here's a link
hope this helps

Author Comment

ID: 12366719

I looked at the php.ini file and it looks like this,

; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textlimit = 4096

A few questions,

- Does ";" comment the line?
- What are the implications of changing this?

Thanks again.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Expert Comment

ID: 12367037
> - Does ";" comment the line?

yes, ";" comment the line

> - What are the implications of changing this?

in this case, you did not enable the mssql.dll extension for the mssql built in functions
and I guess you would be using the odbc instead
so, you can either enable the mssql.dll and take out the ";" for the mssql.textlimit and change the value or I would say it is more appropriate to change the

odbc.defaultlrl = 4096  to odbc.defaultlrl = 0 to let it pass through

hope this helps

Expert Comment

by:Boris Aranovich
ID: 12367691
Also, make sure that the length of the field in the MSSQL database is big enough and is not disregarding the end of the text...

Author Comment

ID: 12383684

ewong_111, you say to change,

"odbc.defaultlrl = 4096  to odbc.defaultlrl = 0 to let it pass through"

So, changing it to "0" will allow for an unlimited amount of characters to go through?


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question