mysql table - text column - has this content
lorem ipsum
lorem ipsum
I fetch this content as php story variable - and need now to create a javascript variable
var story = "<?php echo $story; ?>";
console says:
Uncaught SyntaxError: Invalid or unexpected token
if I change table content to lorem ipsum lorem ipsum - it works fine
so obvioysly the problem is with mysql new line characters
I tried - $story = str_replace(PHP_EOL, "\n", $story); - before echoing in javascript - but the same result
how to solve this ?