Round Posted December 12, 2006 Share Posted December 12, 2006 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>"; mssql_free_result($rs);#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 Quote Link to comment https://forums.phpfreaks.com/topic/30359-php-only-returning-255-characters/ Share on other sites More sharing options...
bibby Posted January 21, 2007 Share Posted January 21, 2007 run "describe table";And check the data type of the column. It's probably varchar(255) or tinytext. It returning the first 255 because it only has 255. Quote Link to comment https://forums.phpfreaks.com/topic/30359-php-only-returning-255-characters/#findComment-165512 Share on other sites More sharing options...
kal3003 Posted March 25, 2007 Share Posted March 25, 2007 convert it to text , in MSSQL Varchar have limitation its only 255 Quote Link to comment https://forums.phpfreaks.com/topic/30359-php-only-returning-255-characters/#findComment-214689 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.