title: new line using string replace
body: <p>I have problems with getting data from mysql database.Let's say that I have text like this in mysql table:</p>
  
  <pre><code>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  
  Suspendisse lobortis sit amet est in dapibus. Cras in dui diam.
  </code></pre>
  
  <p>This new line makes the problem.</p>
  
  <p>I'm using jQuery to echo data to auto creatinig div's.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>for(i = &lt;?php echo $row; ?&gt;; i &gt; 0; i--){
      count = 1;
      &lt;?php
          while($col = mysqli_fetch_assoc($result))
          {
              $cols[] = $col;
          }
          foreach($cols as $col){
      ?&gt;
      $("#text"+count+"").text("&lt;?php echo $col['post'] ?&gt;");
      $("#username"+count+"").text("&lt;?php echo $col['username'] ?&gt;");
      count++;
      &lt;?php } ?&gt;
  }
  </code></pre>
  
  <p>I've tried to remove new line or to replace it with <code>&lt;br&gt;</code> using string replace like <code>str_replace("\n", '&lt;br /&gt;', $col['post']);</code> but it didn't work. I've also tried many other codes and nothing worked for me. </p>
  
  <p>Thanks for suggestions</p>