I have a data migration script to pull data from our old schema into the new one, and the old comments are broke across two separate fields. I had this code:
$comments_part_1 = substr($response[$comment['comment_lbl']],0,6800);
$comments_part_2 = substr($response[$comment['comment_lbl']],6800);
However, I found that $comments_part_1 ends up being more than 6800 characters since there are a lot of line breaks in some of the comments. So my insert statement ends up being more than 6800 characters for that field, and I get an error in MySQL when I try to insert it. And of course I'm losing / missing data in this scenario as well.
I did some searches before I posted here, but couldn't find what I need to get this working. Anyone out there know how I can account for the line breaks (\r\n) in the substr functions above? Doing a preg_replace before and after I do the substr could work too, if that's the best / easiest way to make this work.