Jump to content

[SOLVED] How to remove (replace) carriage returns in output code..


cgm225

Recommended Posts

Let's say I have a line of code in a MySQL table as following:

 

This is some text in a database table with a carriage
return in the middle of it!

 

Now, if I grab that code and echo it, the text will show up in the browser with no line break, which is fine.  HOWEVER, if you look at the page source for that code, there is still the carriage return in the middle of the line.  My question is, how can I remove that carriage return from the text in the source code.

 

Sincerely,

cgm225

 

    db_connect();
    $query = "SELECT * FROM notes WHERE title = '$title'";
    $result = mysql_fetch_array(mysql_query($query));
    if (!$result['title']) {} else {
        $note = $result['note'];
        $noteID = $result['noteID'];
        $date = $result['date'];
        $time = $result['time'];

        $note_modified = str_replace("\r\n"," ", $note);

        $pubdate = date("D, d M Y H:i:s", $time) . " GMT";
        $item = "\t<item>\n\t\t<title>Notes:: $title</title>\n\t\t<link>http://www.kilbad.com/notes/$noteID</link>\n\t\t<guid>http://www.kilbad.com/notes/$noteID</guid>\n\t\t<pubDate>$pubdate</pubDate>\n\t\t<description>$note_modified</description>\n\t</item>\n\n";
        $handle = fopen($rss_file, 'a');
        fwrite($handle, $item);
        fclose($handle);
    }

    mysql_close();

 

I just want all of the text from the note to be in one continuous line in the outputted source code..

 

thanks

cgm225

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.