Reply to Error creating CSV out of SQLdb

Your name:

Reply:


Posted by ND on 12/07/05 14:31

Hi,
I have the following coding problem:

I have a evaluation form with some questions.
Some of these questions are answered by a textarea (which gives the user the
possibillity to use [enter] and make a new line feed in the answer).
The answers are recorded into a database.

This all works fine, but!

When I want to output my answers to a .csv file, the 'new line feeds' of the
textarea fields are messing up my grid in the csv (excel text file seperated
by semicolon ';').
I write the answers to a file which can be downloaded but the 'new line'
makes an abrupt stop to a line.

Hope somebody understands the problem.
How can I work around this 'little' error?

I've tried the following without any results :-(

$value=ereg_replace('\r\n','',$value);
$value=ereg_replace('\r','',$value);
$value=ereg_replace('\n','',$value);

I'm guessing that since there is no actual \n to be found in the $value
field it does not replace anything.

the nl2br function DOES however recognize the \n but it keeps the \n in the
text:
a combination where \n is replaced by <br /> which is deleted in step2:

$value=nl2br($value);
$value=ereg_replace('<br />','',$value);

But I still get the 'new lines' in my output file. I don't want this!! I
want one continued file with info....


Thanks a million!

Daniel

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация