guitarist809 Posted March 21, 2007 Share Posted March 21, 2007 Hello everybody. I'm trying to do a "mass update" in a table of mine the structures is as follows id, name_id, location_id, comments. Before, i used to have to manually enter <BR> for a newline (in the comments), but i just found about nl2br(). Is there a query i can do to update all the text in the comments field (for every row) to replace any <br>'s with \n's? UPDATE table SET comments=REPLACE('<br>', '\n') WHERE 1 Thats what I'm trying to do... Any help would be greatly appreciated, Thanks, -Matt Quote Link to comment Share on other sites More sharing options...
guitarist809 Posted March 22, 2007 Author Share Posted March 22, 2007 [bump] Quote Link to comment Share on other sites More sharing options...
fenway Posted March 22, 2007 Share Posted March 22, 2007 You aren't calling the replace() function correctly... check the docs. Quote Link to comment Share on other sites More sharing options...
guitarist809 Posted March 22, 2007 Author Share Posted March 22, 2007 well yea, i was doing pseuidocode basically I'm trying to update every row's comments with replacing all <br>'s with \n's Quote Link to comment Share on other sites More sharing options...
fenway Posted March 22, 2007 Share Posted March 22, 2007 Well, you are correct, that would be the way to do it, though I'm always scared of updates without WHERE clauses. Quote Link to comment 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.