the following code I use to populate t able via AJAX –
$sql = "SELECT * FROM web_task_comments WHERE web_task_id = '$taskId'
ORDER BY log_date DESC";
$result = mysql_query($sql)or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while($obj = mysql_fetch_object($result)) {
$arr[] = $obj;
}
echo json_encode($arr);
}
There is a row in the DB that will need nl2br() and then pass that back to AJAX request. How do I do this with my current setup? Can you use MySQL to convert nl to br in the query?
Thanks
Rory
You could use
REPLACE-function of MySQL to replace all newlines and carriages\nand\r\nby<br />:http://dev.mysql.com/doc/refman/5.1/de/replace.html