php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37757 Result fetched from MSSQL is truncated to 255 characters
Submitted: 2006-06-09 07:16 UTC Modified: 2006-06-12 01:56 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nguyenhoang at vnideadesign dot com Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.1.4 OS: XP sp2
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 24 = ?
Subscribe to this entry?

 
 [2006-06-09 07:16 UTC] nguyenhoang at vnideadesign dot com
Description:
------------
Problem on: PHP 5.1.2 and 5.1.4
OS: Windows XP sp2
Server: Apache ( apache2triad 1.5.4/1.4.4 and WAMP5 with PHP 5.1.4 i was un/installing each of these server to test)
I'm sure that I connected to MSSQL server 2000 and ran a stored procedure ( after enable mssql extention ) but i only got the first 255 characters from the remote MSSQL server. From PHP version 5.1.2, I upgraded it to PHP 5.1.4 but the result is as it was on PHP 5.1.2. Read the note from other PHP user, i got these way to fix this problem:
-in php file:
mssql_query("set textsize 4000", $s); // <<<<<<<<
ini_set('mssql.textsize', '4000');
ini_set('mssql.textlimit', '4000');
-in php.ini
mssql.textlimit = 4096
mssql.textsize = 4096

After the fix, the result has no changed, always is the first 255 chars appeared.

Reproduce code:
---------------
Here is the code.
//Connect:
$s = @mssql_connect($myServer, $myUser, $myPass) or die("He Thong dang ban. Xin ban thu lai trong giay lat. Chung toi rat tiec vi su co nay. Rat mong ban thong cam..");
$d = @mssql_select_db($myDB, $s) or die("He Thong dang ban. Xin ban thu lai trong giay lat. Chung toi rat tiec vi su co nay. Rat mong ban thong cam..");
//.......other code here, then the line to got row Text from MSSQL database
/*
#GOT INFO - QUERY DATABASE!!!!!!!
*/
$datetime = $d . "/" . $m . "/" . $y;
if ($smstxt[1] == "SAT") {
// Bind datetime
$rs = mssql_query("TG_SAT '$datetime','$enableU2Text'");
} else {
$rs = mssql_query("TG_CAT '$datetime','$enableU2Text'");
}
$row = mssql_fetch_array($rs);
// Display the result
GoKannel($row['Text']); //


Expected result:
----------------
I have no idea to expect what problem with my code. It run perfectly with other part of the scipt. I wish that the text on MSSQL was not more than 255 chars, If so this should not be a problem. Maybe there was a problem with php_mssql.dll extention or maybe I am a stupid PHP coder :( Hope u can give me an answer. Thanks


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-09 16:05 UTC] fmk@php.net
This is a limitation in Microsofts DBLIB, used to build the extension.

You can switch to php_dblib.dll This is a drop in replacement for mssql_* functions build with FreeTDS
 [2006-06-12 01:56 UTC] nguyenhoang at vnideadesign dot com
Hi, 
I fixed this by changing nvarchar to TEXT and the result is showed with full text as I should be.
Thanks for ur help
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 01 20:01:29 2024 UTC