Hello all, my php is not good. I have got wordwrap here. it works perfect. $text=$row['description']; $newtext = wordwrap($text, 100, "\n", true); echo "$newtext\n"; PHP: I want to use $newtext\n instead of $row['description'] in here aswell. <td align="left"><?=substr($row['description'],0,500); ?></td> PHP: I do not know how to do. can anyone help me? Thanks
Your syntax looks screwed, try this <td align="left"><?php echo substr($newtext, 0, 500); ?></td> Code (php):
I think he expects it to wrap in html, of course he needs to put <br>'s in instead of \n's <td align="left"><?php echo ereg_replace("\n","<br>",substr($newtext, 0, 500)); ?></td> PHP: or <td align="left"><?php echo nl2br(substr($newtext, 0, 500)); ?></td> PHP:
I have got 2 pages. 1-listing 2-description At the moment i am using this on description page $text=$row['description'];$newtext = wordwrap($text, 100, "\n", true);echo "$newtext\n"; PHP: it puts space if the word is longer than 100 character. It works perfect. I am using this for listing page <td align="left"><?=substr($row['description'],0,500); ?></td> PHP: I am limiting the content to 500 character. It works perfect. But i get problem if there is words like dddddddddddddddddddddddddddd to stop that i want to use <td align="left"><?php echo substr($newtext, 0, 500); ?></td> PHP: but does not work.