Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

Recommended Posts

I am working on #4 pursue (chapter 12):

convert newline characters into HTML break tags:


It looks like I need to use the n12br but I can't get it to work in my view_entry.php. I thought I could simple add this code after the print below but it doesn't work. Many examples that I found show using the echo but I tried that and it doesn't work either. Any suggestions?



while ($row = mysql_fetch_array($r)){

print n12br("<p><h3>{$row['title']}</h3>

{$row['entry']}<br />

<a href=\"edit_entry.php?id={$row['entry_id']}\">Edit</a>

<a href=\"delete_entry.php?id={$row['entry_id']}\">Delete</a>

</p><hr />\n");

Share this post

Link to post
Share on other sites

You have the function name wrong; it should be nl2br(), not n12br(). That's a lower-case L, not the digit one. Read it as "nEW lINE to brEAK"


Typography can mess you up sometimes...

  • Upvote 1

Share this post

Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Sign in to follow this  

  • Create New...