Jump to content

PHP only returning 255 characters


Recommended Posts

I'm connecting to a Microsoft sql db using

$conn = @mssql_connect(  "server", "username", "password" )
      or die( "Err:conn");

$rs = @mssql_select_db( "dbname", $conn)
or die( "ERR:Db");

I am using text boxes etc to populate tables using inserts and updates etc, this all works fine and as long as the amount of characters being sent to the db doesn't exceed the columns datatype amount, it's ok.

When I try to retrieve any data using the same connection method and then

$sql = "select * from table";

$rs = mssql_query( $sql, $conn )
or die( "Check Query");

$row = mssql_fetch_array( $rs );

$list = "<h3><b>Title :  </b>".$row["column_name"]."</h3>";
$list .= "<p><b>Title :  </b>".$row["column_name2"]."</p>";
$list .= "<p><b>Title :  </b>".$row["column_name3"]."</p>";
$list .= "<p><b>Title :  </b>".$row["column_name4"]."</p>";
#list details
echo( $list );
mssql_close ( $conn );

It is only displaying the first 255 characters of each column retrieved??

The columns are set to varchar(2000) in the db. It has been suggested to change all the datatypes to TEXT, but I am reluctant to do this as there are quite a few columns used and 1000's of records. Also I'm pretty sure this would effect all of the inserts/updates being used throughout the site, and through testing I can only get a text datatype to hold just over a 1000 characters which isn’t enough for now or even future expansion.

I have set the mssql.textlimit and mssql.textsize to its maximum within the php.ini file and this hasn't made any difference either.

Does any body have any ideas??

We currently have an ASP site which is essentially doing the same thing but does not suffer from the same problem, it is connecting to the db using:

set con=Server.CreateObject("ADODB.Connection")
con.open "PROVIDER=SQLOLEDB;DATA SOURCE=server; UID=username; PWD=password;DATABASE=dbname"
(if that helps?)

Many Thanks

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
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.

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.