Welcome to WebmasterWorld Guest from 54.198.69.193

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Delete from HTML source <br />

using sql replace

     
11:42 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



Hello,

I have many articles that have this <br /> in my HTML source:

takes no obligation to revise the forward-looking statements contained ther<br />
ein to reflect events or circumstances after the date hereof as a result of<br />

It is ok to add:

$query = 'update wp_posts set post_content=REPLACE(post_content,"<br /> ","")';

But it doesnt delete, why?

Regards,
Dan

12:00 am on Jan 6, 2006 (gmt 0)

5+ Year Member



I used strip_tags($row_Edit['Text'], '<br />'); to accomplish this.
12:03 am on Jan 6, 2006 (gmt 0)

10+ Year Member



Hi Invenio,

but how can I add
you idea in query = 'update wp_posts set post_content=REPLACE(post_content,"<br /> ","")';?

in this?
$query = 'update wp_posts set post_content=strip_tags($row_Edit["Text"], "<br />","")';;

I want to delete from html source <br />

It is ok that code?

12:19 am on Jan 6, 2006 (gmt 0)

10+ Year Member


Isnot working also:

$query = 'update wp_posts set post_content=REPLACE(post_content,"<br \/> ","")';
mysql_query($query);

WHY?

12:19 am on Jan 6, 2006 (gmt 0)

5+ Year Member



Try it and see...that's how I test code. :)
12:23 am on Jan 6, 2006 (gmt 0)

10+ Year Member



I got this error:

$query = 'update wp_posts set post_content=strip_tags($row_Edit["Text"], "&lt;br /&gt;","")'

MySQL said:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '$query = 'update wp_posts set post_content=strip_tags($row_Edit

12:28 am on Jan 6, 2006 (gmt 0)

5+ Year Member



You have to change:

"Edit["Text"]"

To match your database setup.

12:30 am on Jan 6, 2006 (gmt 0)

10+ Year Member



what is TEXT?

<br />?

12:32 am on Jan 6, 2006 (gmt 0)

10+ Year Member



I used now:

$query = 'update wp_posts set post_content=strip_tags($row_post_content["Text"], "<br />","")';
mysql_query($query);

no changes

What I need is to delete <br />

12:34 am on Jan 6, 2006 (gmt 0)

10+ Year Member



takes no obligation to revise the forward-looking statements contained ther<br />
ein to reflect events or circumstances after the date hereof as a result of<br />

If I will delete just <br /> the text will look like:

takes no obligation to revise the forward-looking statements contained ther ein to reflect events or circumstances after the date hereof as a result of

will put space between "ther ein"

12:37 am on Jan 6, 2006 (gmt 0)

5+ Year Member



$row_Edit['Text']

"edit" = the name of your recordset
"text" = the name of your column

12:45 am on Jan 6, 2006 (gmt 0)

10+ Year Member



I used this
$query = 'update wp_posts set post_content=strip_tags($row_post_content["&lt;br /&gt; "], "")';

no working

12:51 am on Jan 6, 2006 (gmt 0)

10+ Year Member



$row_Edit['Text']
"edit" = the name of your recordset
"text" = the name of your column

I still I dont understand:

My tabel is: wp_posts
My columns with posts is: post_content

So will look like:

$query = 'update wp_posts set post_content=strip_tags($row_wp_posts["post_content"], "<br />","")';

I still get

MySQL said:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '$query = 'update wp_posts set post_content=strip_tags($row_wp_p

1:30 am on Jan 6, 2006 (gmt 0)

5+ Year Member



What are you trying to do with the data once you strip those tags?
4:22 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



your variable isn't being parsed by php because it is between single quotes and you need to concatenate those array values into your string

you have
$query = 'update wp_posts set post_content=strip_tags($row_post_content["Text"], "<br />","")';

should be
$query = 'update wp_posts set post_content=strip_tags(' . $row_post_content["Text"] . ', "<br />","")';

 

Featured Threads

Hot Threads This Week

Hot Threads This Month