Hi
I've got a string I'm trying to feed into the database. The string is over 8000 characters long which is longer than the db can store. What I am trying to do is count the length of the string, and then do a substring on it and feed it into to fields if the length is bigger than 8000. Both fields on the db are varchar set to a mx length of 8000.
$len = strlen($bodytext);
print($len);
if($len < "7999")
{
$bodytext1 = $bodytext;
$bodyqryins1 = " insert into tbxlogemailtemplate (Email_ref,Header_Title,Subject_Line,Body_text) values (\"$emailref\",\"$headtit\",\"$subj\",'$bodytext') ";
$bodyqryins1res = mssql_query($bodyqryins1);
}
else
{
$bodytext1 = substr($bodytext,0,7999);
$len1 = strlen($bodytext1);
$len2=($len-$len1);
$bodytext2 = substr($bodytext, 8000,$len2);
$len3 = strlen($bodytext2);
$bodyqryins = " insert into tbxlogemailtemplate (Email_ref,Header_Title,Subject_Line,Body_text,Body_Text2) values (\"$emailref\",\"$headtit\",\"$subj\",'$bodytext1','$bodytext2') ";
$bodyqryinsres = mssql_query($bodyqryins);
}
When I do this, I get an error message saying a string greater than 8000 in length cannot be inserted..
Anyone got any idea?
Thanks