Jump to content

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


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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.