i have a text area from which when i try to escape and sanitize through MYSQLi's real_escape function and nl2br and simply output is giving me odd results.
my php code:
 <?php
 $db = new mysqli('localhost', 'user', 'pass', 'demo');
 if($db->connect_errno > 0){
 die('Unable to connect to database [' . $db->connect_error . ']');
 }
 $postText = nl2br($db->escape_string($_POST['posting']));
  ?>
the odd output is :
 i love this\r\n\r\nand this is gonna be funn.,
and strangely when i just use nl2br without real_escape is giving the output fine which obviously can't move ahead with as i cant trust user"s input.
Please help on this..
 
     
     
     
    