Jaguar Posted September 24, 2008 Share Posted September 24, 2008 I have a description field (text type) in an SQL Server 2005 database. Some of the descriptions in the database are long, 4500+ characters. When I select and try to print the descriptions, they get cut off at 4100 characters. Has anyone experienced this? I tried inserting values over 4100 characters long into the database through PHP and it works, but selecting the value back gets cut off at 4100 characters in PHP. $sql = "SELECT name, description FROM Users ORDER BY name;"; $result = mssql_query($sql); while($row = mssql_fetch_assoc($result)) { echo $row["name"] . ":"; echo "<br /><br />"; echo $row["description"]; } Quote Link to comment https://forums.phpfreaks.com/topic/125661-solved-4100-character-limit-on-string-length/ Share on other sites More sharing options...
Jaguar Posted September 25, 2008 Author Share Posted September 25, 2008 I found the answer in the comments of the PHP docs. Here's how you fix it if anyone stumbles across this in the future: ini_set("mssql.textlimit", "65536"); ini_set("mssql.textsize", "65536"); Quote Link to comment https://forums.phpfreaks.com/topic/125661-solved-4100-character-limit-on-string-length/#findComment-650555 Share on other sites More sharing options...
plimpton Posted December 2, 2008 Share Posted December 2, 2008 Another option would be to use the sqlsrv driver available directly from microsoft: http://blogs.msdn.com/sqlphp/ Quote Link to comment https://forums.phpfreaks.com/topic/125661-solved-4100-character-limit-on-string-length/#findComment-704218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.