Hi
I'm unfortunately in a situation where I have to write a js array with data from a db - the problem is that the text strings from the db contain line returns and this is causing a real problem with js because it cuts the line and returns the error "unterminated string literal"
so what I'd like to do is replace the line returns with "<br>"
here's what I'm trying at the moment:
while($row2=mysql_fetch_array($res2)){
$imageV = $row2['ima_file'];
$textV = stripslashes($row2['ima_text']);
$textV = str_replace('[/\n/]', '<br>', $textV);
$textV = str_replace('[/\r/]', '<br>', $textV);
echo "imagesArray[i] = new Array('".$imageV."','".$textV."');\n";
}
which writes this in the page :
var imagesArray = new Array();
imagesArray[i] = new Array('rotate.gif','Conception logo et charte graphique d’un producteur distributeur
Client : Le Moulin des Costières');
imagesArray[i] = new Array('opticwaves.gif','Conception logo et charte graphique d’un producteur distributeur
d’huiles d’olive et produits de gastronomie méditerranéenne.
Client : Le Moulin des Costières');
imagesArray[i] = new Array('graphiste-623a87cd600d23d1.gif','rotate on this one');
as you can see it still goes to a new line in the middle of each string literal
what can i do to remedy this ?
thanks