Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6132315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:05:15+00:00 2026-05-23T17:05:15+00:00

I am having difficulty with displaying HTML it seems. haha, let me explain. I

  • 0

I am having difficulty with displaying HTML it seems. haha, let me explain.

I have 1 template file for “comments”… and it tells things where to go and such in the html. When Adding, Updating and Selecting any of the “comments”

IE:

<div class='comment'>
   <div>{$name}</div>
   <div>{$comment}</div>
</div>

So within my comment I need to pull the COMMENT from the database which includes, \n

So I go like this.

$comment = nl2br($comment);
<div class='comment'>
   <div>{$name}</div>
   <div>{$comment}</div>
</div>

And this does work… But when I do an UPDATE via jQuery I use,

$("#"+ target +"").replaceWith(responseText);

And the responseText includes all HTML… but some reason, it still is including the \n… and not

I don’t know if this is a limitation with Javascript, or rendering issues. Just not sure where else to go here…Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:05:16+00:00Added an answer on May 23, 2026 at 5:05 pm

    Well this was a tad strange, there was some issues that I didn’t fully test and sorry for maybe not clarifying. But mysql_real_escape_string() was causing issues with the \n being stored in the database.

    There for I am looking at using this function instead. Found on php.net’s website

    function mysql_escape_mimic($value) {
            if(isset($value)) 
            {
                if(is_array($value)) {
                    return array_map(__METHOD__, $value);
                }
    
                if(!empty($value) && is_string($value)) {
                    //return str_replace( array('\\',   "\0",  "\n",  "\r",   "'",  '"',  "\x1a"), 
                    //                  array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $value);
    
                    return str_replace( array('\\',   "\0",  "\r",   "'",  '"',  "\x1a"), 
                                        array('\\\\', '\\0', '\\r', "\\'", '\\"', '\\Z'), $value);
                }
    
                return $value;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and
Having difficulty making my javascript act the way I want. I have a button,
I'm having difficulty translating sql to linq syntax. I have 2 tables (Category and
I am having difficulty with Html Helpers when used with Razor. Said helpers worked
I'm having difficulty combining some lines in a comma delimited text file if the
I'm having difficulty in retrieving values from a Json array. I have a Json
I'm a newbie to rails and am having some difficulty... I have a page
I'm using jQuery Stars Rating plugin ( http://www.fyneworks.com/jquery/star-rating/ ). I'm having difficulty displaying an
Am having some difficulty getting an Image from a url, and then displaying it
I am having difficulty reliably creating / removing event sources during the installation of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.