Remove brake from mysql query

i get $text string from a mysql query

for echo $text, i see in the browser “line1 line2”

however, $text is to insert in a <meta name=“description” content=“‘.$text.’” />
and when i check the view source of the page i see…
<meta name=“description” content=“line1
line2” />

instead of
<meta name=“description” content=“line1 line2” />

i stripped all tags from strip_tags…

how can i remove this line to have the code without the break?..

Many thanks!

r937 it WORKED!

thank you very much… you rock!

aaargh, i should have said 0A and 0D, not 0C and 0D

Just replace the new line with space :wink:


$txt = str_replace( "\
" , " " , $string );

Any doubts to know how it works ? This link will help you str_replace

that’s because the browser collapses all white space, and a line break is considered white space in html source code

it sounds like you have actually stored the line breaks

you could filter them out in the query…


SELECT Replace(Replace(textcolumn,x'0C',''),x'0D','') AS textcolumn, ...

but you could/should replace the CR/LF before you store the data