HoTDaWg Posted August 13, 2009 Share Posted August 13, 2009 hey guys, the wordwrap function was not working for me, so i decided to try to create my own function; the problem is i keep getting this error saying that im using an Uninitialized string offset: 128. Could the problem be with how i wrote the code? or does the problem lye elsewhere? <?php while($row = mysqli_fetch_array($result)){ $thethecomment = $row['comment_comment']; $newnewcomment = ''; for($d=0; $d<=strlen($thethecomment); $d++){ if ($d%10 == 0){ $newnewcomment .= '<br>' . $thethecomment{$d}; }else{ $newnewcomment .= $thethecomment{$d}; } } $comments.= '<hr><b>'.$row['comment_name'].'</b> Wrote on ' . date('l, F jS, Y h:i a',$row['comment_date']).':<br><br>' . $newnewcomment . '<br>'; } ?> basically it should be outputting the comment(taken from the database) and putting a <br> every 10 characters. but all it does is return this error. any ideas? thanks for any help possible. HoTDaWg Quote Link to comment Share on other sites More sharing options...
HoTDaWg Posted August 13, 2009 Author Share Posted August 13, 2009 okay so adding to my problem, my main issue is just with a comment section i am designing. the problem is whenever a user is to enter a comment (via a textarea) such as: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa where the width of the letters exceeds the width of the page, it ruins my whole layout. ive tried setting the textarea to wordwrap=hard and ive tried the wordwrap function and my own custom function how do you guys deal with word wrapping the values of text areas so that they do not ruin your layout? Quote Link to comment Share on other sites More sharing options...
HoTDaWg Posted August 13, 2009 Author Share Posted August 13, 2009 okay, turns out by using the wordwrap function and setting the CUT parameter to true, one can seperate those incredibly long aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa so they dont ruin ur layout. thanks anyways everyone Quote Link to comment 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.