Guest Posted August 10, 2004 Posted August 10, 2004 Hello, Is there a way i can use sql commands, to edit all product descriptions so that i can remove <P><STRONG><FONT size=3>.....</FONT></STRONG></P> and just leave the ... (the description itself) thanks
♥bruyndoncx Posted August 10, 2004 Posted August 10, 2004 yes, mysql has the necessary function: REPLACE(str,from_str,to_str) Returns the string str with all occurrences of the string from_str replaced by the string to_str. mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww'); -> 'WwWwWw.mysql.com' This function is multi-byte safe. so your sql becomes: UPDATE Products_Description SET products_description = REPLACE(products_description, '<p><strong><font size=3>','') for the first html sequence to replace, similar construct for the second one. KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
Guest Posted August 12, 2004 Posted August 12, 2004 that is a nice trick. But its almost the same thing as if i was editing it through admin. All my products (which have different product names) have the product name being repeated in the description. Can't i perform a sub-query that matches any product name in the product description and then calles the replace function. thanks
♥bruyndoncx Posted August 12, 2004 Posted August 12, 2004 UPDATE Products_Description SET products_description = REPLACE(products_description, products_name,'') This will replace the products_name in the description field, if it doesn't find it, it will just update the description with itself KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
Recommended Posts
Archived
This topic is now archived and is closed to further replies.