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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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.
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.


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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
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 count occurrences of each item in an array.

695 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