I’m storing a long text with mssql_query();
And Using the field with datatype called ‘text’.
I tried with different long strings by using str_repeat(), the page takes long time, but in the end submits the result.
When I retrieve the result however, I get only 4096 bytes nomatterwhat.
I tried to retrieve the value with management studio too, and it gets the same outcome.
It looks to me like a storing problem to me. Please advice something… I’m confused.
EDIT for these who asked, this is what I’m using:
function sql_escape($sql) {
/* De MagicQuotes */
$fix_str = stripslashes($sql);
$fix_str = str_replace("'","''",$sql);
$fix_str = str_replace("\0","[NULL]",$fix_str);
return "'".$fix_str."'";
}
$query=mssql_query('update prod_cat set htmlbottom='.sql_escape(str_repeat('\'choose_cat ', 122000)).
' where ID=1' );
$query=mssql_query('select htmlbottom from prod_cat where ID=1');
$a=mssql_fetch_assoc($query);
echo strlen($a['htmlbottom']);
Microsoft’s PHP driver (for reference): http://www.microsoft.com/en-us/download/details.aspx?id=20098
But if you don’t want to (or can’t) change drivers, from this site:
Your MSSQL driver is truncating the text. If you can’t change datatypes, drivers, etc., this should fix the issue for you.