Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2012, 03:34 PM   PM User | #1
mathceleb
Regular Coder

 
Join Date: Mar 2010
Posts: 235
Thanks: 39
Thanked 6 Times in 6 Posts
mathceleb is an unknown quantity at this point
Query with Special Characters

I'm trying to do a replace and I get this error:

#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 '\[field_author-nid\]) WHERE display_options LIKE '<a href=\"http://www.test.' at line 1

I tried double backslash with the brackets as well.

Code:
update views_display set display_options = replace(display_options, '<a href=\"http://www.test.com/author/\[field_author-nid\]\">\[field_author\\</a>', \[field_author-nid\]) WHERE display_options LIKE '<a href=\"http://www.test.com/author/[field_author-nid]\">\[field_author\]</a>'
mathceleb is offline   Reply With Quote
Old 10-12-2012, 03:44 PM   PM User | #2
mathceleb
Regular Coder

 
Join Date: Mar 2010
Posts: 235
Thanks: 39
Thanked 6 Times in 6 Posts
mathceleb is an unknown quantity at this point
Oh boy, long day. I got it to work:

PHP Code:
update views_display set display_options replace(display_options'<a href="http://www.test.com/author/[field_author-nid]">[field_author]</a>''[field_author-nid]'WHERE display_options LIKE '%<a href="http://www.test.com/author/[field_author-nid]">[field_author]</a>%' 
mathceleb is offline   Reply With Quote
Reply

Bookmarks

Tags
special characters

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:14 PM.


Advertisement
Log in to turn off these ads.