Jump to content

[SOLVED] String length limited to 255 characters?


mr_bijae

Recommended Posts

I have an application that is running PHP 5.2.5 and connecting to a MS SQL 2005 server. I ran into an issue this morning when a report that I built returned only 255 characters of a text field. A manual review of the table in the database verified that the entire 273 character string was stored in the database. I'm using a pretty simple function to get my data from the server. I've never run into this problem before, and have searched only to find that some have stored 2 billion characters in a PHP variable before. So I'm posting to you for help. Here's the entire script:

 

$open_event = recent_closed_events();

 

foreach($open_event as $o) {

$message = $o->message;

$len = strlen($message);

if($len > 200) echo "$len<br>$message";

}

 

 

class events{

var $siebelacctid;

var $description;

var $id;

var $subjectline;

var $message;

var $peripheraldesc;

var $custid;

var $dateinserted;

var $serverip;

var $ColorIndex;

var $date_text;

var $srstatus;

var $moddate;

var $modby;

 

function events() {

}

}

function recent_closed_events() {

$dbmgr = new DBManager();

$sql = "select top 30 Consolidated_Alerts.Message as Message

from Consolidated_Alerts";

$dbmgr->execQuery($sql);

$num_rows = $dbmgr->numrows();

//echo $sql . "<p>";

$events_array = array();

if(!$num_rows) {

return $events_array;

}

for($i = 0; $i < $num_rows; $i++) {

$result = $dbmgr->next($i);

$get = new events();

$get->message = $result['Message'];

 

$events_array[$i] = $get;

}

return $events_array;

}

 

The above script produces results similar to this:

255

MEDIUM PNG 77004 - CCM has lost communication to the following Voice Gateway. 237026: Jan 24 02:30:22.798 UTC : %CCM_CALLMANAGER-CALLMANAGER-2-MGCPGatewayLostComm: MGCP communication to gateway lost. Device Name:wmo1rtr001.company.com App ID:Cisco Cal

 

Has any one seen something like this before? I've verified in the database that the string is infact 300 characters in the above instance, however, PHP seems to only load 255 from the database.

 

I'm grateful for any suggestions.

 

Brian

Thanks for the reply. Here's the information:

 

  function next($row_number="")

        {

                if ((!$this->conn_id) || (!$this->result))

                        return false;

 

                if ($row_number=="")

                        $row_number=$this->row_number;

 

                //return pg_fetch_array($this->result, $row_number);

                return mssql_fetch_array($this->result);

        }

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.