Germaris Posted November 12, 2006 Share Posted November 12, 2006 Hi there !I'm quite desperate as I can't find a quick method to partially change the content of a field.I explain:In a field named 'notes', PART of the content is:[code]<a href='mailto:"[email protected]"'>[email protected]</a>[/code]This content is wrong.It must be:[code]<a href="mailto:[email protected]">[email protected]</a>[/code]How can I make the change with a SQL Query instead of manually make the change row by row (approximately 1500 rows contain the error!!!) considering the fact that [email protected] is different in each of the rows?Many thanks in advance for any help!Best regards,Gerard Quote Link to comment https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/ Share on other sites More sharing options...
fenway Posted November 12, 2006 Share Posted November 12, 2006 Not easily, really... REGEXP is useful for matching these rows, but you can't use Perl-style regexs to replace, AFAIK. However, you can use a combination of LOCATE() and REPLACE(), since you can probably make some simplifying assumption about the location of these extra quotes. Quote Link to comment https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/#findComment-123592 Share on other sites More sharing options...
Germaris Posted November 12, 2006 Author Share Posted November 12, 2006 Thank you for your reply!But it looks like Chinese for me... ;D i.i. I don't understand what you wrote...I'm looking for a SQL Query which I can enter in phpMyAdmin... Quote Link to comment https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/#findComment-123597 Share on other sites More sharing options...
jsladek Posted November 13, 2006 Share Posted November 13, 2006 I know this is a php board but maybe it would be simpler to export the data to a flat file and do a find and replace with any program of your choice.then import the data back in.With phpMyAdmin this would be pretty simple.-RegardsJohn Sladek Quote Link to comment https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/#findComment-123775 Share on other sites More sharing options...
Germaris Posted November 13, 2006 Author Share Posted November 13, 2006 WOW! VERY SMART... and CRYSTAL CLEAR.Why shouldn't think about this solution before?Many thanks.Best,Gerard Quote Link to comment https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/#findComment-123889 Share on other sites More sharing options...
fenway Posted November 15, 2006 Share Posted November 15, 2006 I was simply suggesting replacing href='" with href =", and the same for the other double quote... but hey, if you want to go around in circles, fine with me... whatever works. Quote Link to comment https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/#findComment-125096 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.