Jump to content

Removing Line Breaks In String Variable.


markhfla

Recommended Posts

I'm trying to send text from a mysql database to a flash file through a string variable. But, the string shows up in my code with line breaks from when it was entered into the database from a form. In order for the flash file to read the string, it must all be on one line in the code.

 

How can I remove these line breaks using PHP? I don't really want to remove them from the actual database text.

 

Here's what I'm getting:

description_text.swf?description=This is the way it's showing up with the
<br>
tag and on separate line. This doesn't work.

 

Here's what I want:

description_text.swf?description=This is the way I want it to show up with the<br>tag and all on one line. This does work!

Link to comment
Share on other sites

WOW! That's the fastest response I've ever gotten. Thanks.

 

Unfortuantely, I've tried that and it doesn't work.

 

If this helps, here's some of the code:

$desc = str_replace("'","'",$myrow["full_description"]);
$desc = str_replace('"',""",$desc);
$desc=str_replace("<p>","<br><br>",$desc);
$desc=str_replace("\n","",$desc);

Link to comment
Share on other sites

DarkWater,

 

A thousand blessings on your household! That worked. WHEW!

 

 

GuiltyGear,

 

I built the admin for this site years ago. So, my client just enters an open p tag. One of these days I'm going to have to get around to adding an html editor. Although, with the current problem I just had, maybe that's not such a good idea! :-P

Link to comment
Share on other sites

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.