Hi, i'm a PHP newbie and i'm working on a CSV powered
news/blog system for practice. I'm trying to take form
input and convert it into html using nl2br() and stripslashes().

Here's the script:

        $news_array = fopen($news_file, "r"); // read in news
        $output = fopen($output_file, "w"); // write amended file
// problem area begins here
        $body = nl2br($body);
        $line = $heading.'|'.$userno.'|'.time().'|'.$body;
        $line = $line."\n" ;
// end problem area
        fwrite($output,$line);
        $count=$start;
        while ($csvdata = fgetcsv($news_array, 1000 , "|")) {
            fwrite($output,implode("|",$csvdata)."\n"); // output amended
line
        } //end while
        fclose($output);
        fclose($news_array);
        unlink($news_file);
        rename($output_file,$news_file);

$body is being taken from a multiline editbox using virtual wrap.

it should write to a file like this:

Bacon, Lettuce and Tamarillo|0|994680000|news<br />on<br />multiplelines
Winamp Skins and Re-design|0|994334400|news<br />on<br />multiplelines
PHP is the shiznat!|0|994075200|news<br />on<br />multiplelines

but it's outputting:

freaking errors|0|994975909|i\'m not liking the error
<br />
<br />at all...freaking errors|0|994975848|i\'m not liking the errorBacon,
Lettuce and Tamarillo|0|994680000|rest of file is on this line

I'm running PHP 4.0.6 on win98 from OmniHTTPd 2.08

Thanks in advance for helping a newbie out :)

Brett Taylor




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to