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
https://forums.phpfreaks.com/topic/170010-solved-uninitialized-string-offset-128/
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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.