Jump to content

MsSQL query in PHP not returning full result


Tazz

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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+.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.