Jump to content

[SOLVED] Uninitialized string offset: 128


HoTDaWg

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.