Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2010
    Posts
    235
    Thanks
    39
    Thanked 6 Times in 6 Posts

    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>'

  • #2
    Regular Coder
    Join Date
    Mar 2010
    Posts
    235
    Thanks
    39
    Thanked 6 Times in 6 Posts
    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>%' 


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •