Tazz Posted December 8, 2009 Share Posted December 8, 2009 I have a MsSQL query in PHP that is supposed to retrieve HTML from the database to be displayed for a blog. It cuts off at a certain stage, I don't know why. Here is my query code: function retrieveSpecificEntry($id) { $sql = "SELECT html FROM Blog WHERE id =".$id; $result = mssql_query($sql); while ($row = mssql_fetch_array($result)) { $entry_array[] = $row; } return $entry_array; } My SQL actually selects '*', that's why I load it all into an array, but for the sake of the forum I just want to show that even selecting just the html field, it still doesnt return all of it. In my database the html field has a varchar(MAX) data type. Its a huge blog entry and it cuts off the last two paragraphs for no obvious reason. After returning the array to the page where the function gets called, I simply echo the contents. Thats it. No other code. So why would it cut off some of my HTML? Quote Link to comment https://forums.phpfreaks.com/topic/184367-mssql-query-in-php-not-returning-full-result/ Share on other sites More sharing options...
vinpkl Posted December 8, 2009 Share Posted December 8, 2009 instead of VARCHAR set it as 'TEXT' in mysql vineet Quote Link to comment https://forums.phpfreaks.com/topic/184367-mssql-query-in-php-not-returning-full-result/#findComment-973287 Share on other sites More sharing options...
Tazz Posted December 8, 2009 Author Share Posted December 8, 2009 Hi vinpkl The data type doesn't make a difference at all. I tried making it text, but it made no difference to the output. So far I have discovered that my query only returns 4099 characters from the database table. I made up some text with over 6000 characters but it only returns 4099 of those. I don't limit the query or results anywhere. I am really at my wit's end. Quote Link to comment https://forums.phpfreaks.com/topic/184367-mssql-query-in-php-not-returning-full-result/#findComment-973289 Share on other sites More sharing options...
Tazz Posted December 8, 2009 Author Share Posted December 8, 2009 I found the answer! In php.ini uncomment and change the following lines in bold to whatever value is required. This allows mssql to return a larger amount of text. ; Valid range 0 - 2147483647. Default = 4096. mssql.textlimit = 7000 ; Valid range 0 - 2147483647. Default = 4096. mssql.textsize = 7000 Quote Link to comment https://forums.phpfreaks.com/topic/184367-mssql-query-in-php-not-returning-full-result/#findComment-973296 Share on other sites More sharing options...
trq Posted December 8, 2009 Share Posted December 8, 2009 I found the answer! In php.ini uncomment and change the following lines in bold to whatever value is required. This allows mssql to return a larger amount of text. ; Valid range 0 - 2147483647. Default = 4096. mssql.textlimit = 7000 ; Valid range 0 - 2147483647. Default = 4096. mssql.textsize = 7000 You really should move to using ms's sqlsrv php driver (google it). The current mssql driver is riddled (trust me) with bugs. I have had nothing but headache's with this stuff for the past few months. Finally persuaded the powers that be to let me use mysql instead, though the sqlsrv driver does look promising if your using mssql 2005+. Quote Link to comment https://forums.phpfreaks.com/topic/184367-mssql-query-in-php-not-returning-full-result/#findComment-973297 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.