I have a table with a field that contains descriptions for items sold on my site.
In our infinite wisdom, when we first launched the site, we entered the code for the Facebook Like button in the description, each of which is slightly different, because it contains product information in the link. Now we have about 400 elements with code.
This is an example of what I mean:
- Cooked, fluffy chocolate-chocolate flavor; Easy way to enjoy chocolate
- 45% less fat
<iframe src = "http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.oursite.com%2Findex.php%3Fmain_page%3Dproduct_info%26cPath%3D33_36%26products_id%3D106& layout = standard & show_faces = true & width = 450 & action = like & ColorScheme = light & height = 80 "scrolling =" no "frameborder =" 0 "style =" border: none; overflow: hidden; width: 450px; height : 80px; " allowTransparency = "true"> </iframe>
I want to remove the <iframe and the whole past. I looked through examples using REPLACE and / or LEFT, but cannot find what I need as I am not very good at SQL.
It will always be at the end of the products_description field, so I donβt have to worry about saving anything behind it, just before it.
The best I can come up with is
SELECT LEFT(REPLACE('<iframe%','<iframe%',' '),0)
but it does not work.
Thanks for any help you can offer regarding this, as it will take me much less time than editing each description.
UPDATE: still have not found the answer, having tried many of the options proposed. It starts, but does not edit the column.
I also tried this by finding it on another site. The same thing, but thought it might give someone an idea of ββhow to proceed:
select left(`products_description`,instr('<iframe',`products_description`)-1) FROM products_description