I'm trying to build a csv file from a database (and other static information) using php -- one of the fields, however, contains html -- this was intended.
When I load this field into the csv file, it returns the results on multiple lines. ie:
Instead of this:
<li>Item one</li><li>Item two</li>
It does this:
<li>Item one</li>
<li>Item two</li>
And, the purpose of the csv file is to use as an imported file for a specific program, but it doesn't work if the field's contents are on multiple lines.
How can I get it to all be on one line? I've tried replacing "\n" with a space, but that doesn't work.
TIA.
csv file - field contents appear on multiple lines
Moderator: General Moderators
Re: csv file - field contents appear on multiple lines
Just for clarification -- this is not a question about the csv file -- my question pertains to a php command I can use that will remove whatever is causing the text in that field to appear on multiple lines instead of in one single line.
Thanks
Thanks
Re: csv file - field contents appear on multiple lines
Try replacing \r\n with a space.
Or, with preg_replace(), replace characters matched by \v (any vertical whitespace character).
Or, with preg_replace(), replace characters matched by \v (any vertical whitespace character).
Re: csv file - field contents appear on multiple lines
THANK YOU!
Replacing \r\n did it.
Replacing \r\n did it.