Results 1 to 6 of 6
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Update Command question in MySQL
    Hi Gang,

    I'm a bit stuck on how to account for some html code in my datafeed. I could drop it and clean it up offline but I'm trying to teach myself how to do this stuff online..

    Basically my import had html code on the import so the field starts like " <IMG SRC="http://". Well, all i want is the " http " so I'm trying to use the update replace command and am not having any luck..

    I'm trying to use the code below and I think it's getting messed up with the double quotes before the http..

    I've tried putting single quotes around the double quotes and that doesn't work. I'm using phpMyAdmin 2.6.1 if that matters..

    Do you have any ideas what I'm doing wrong?? I've got the code below here..

    update sitedb_links set Impressionurl = replace(Impressionurl,'<IMG SRC="http%,'http%')

    Thanks much
    Tony

  2. #2
    Full Member TLE's Avatar
    Join Date
    January 21st, 2005
    Location
    Southern California
    Posts
    338
    Quote Originally Posted by hotspice
    update sitedb_links set Impressionurl = replace(Impressionurl,'<IMG SRC="http%,'http%')
    Hi Tony,

    Try:

    Update sitedb_links
    Set Impressionurl = Replace(Impressionurl,'<img src="http','http')

    You may need another replace for the ending ">".

    Regards,
    Tuan

  3. #3
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Thanks Tuan, I see from your code I was forgetting to close the single.. DOH!! I changed that but it still won't run..

    You can see here that if I just do a select I get plenty of returns.

    SELECT * FROM `sitedb_Links` WHERE `Impressionurl` LIKE '<img src="http%'
    Showing rows 0 - 29 (8721 total, Query took 0.0006 sec)


    But the update returns nuttin. Oh, in the db the IMG SRC are ucase so that's why i have them that way in the update..

    Update sitedb_Links Set Impressionurl = Replace(Impressionurl,'<IMG SRC="http%','http')
    Affected rows: 0 (Query took 0.9689 sec)

  4. #4
    Full Member TLE's Avatar
    Join Date
    January 21st, 2005
    Location
    Southern California
    Posts
    338
    Hi Tony,

    Please try it without the % character.

    Tuan

  5. #5
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Quote Originally Posted by TLE
    Please try it without the % character.
    "Affected rows: 8720 "
    Well I'll be... I always put it there because without it my select statement didn't work so I thought I had to have it for my update statement..

    Show's what a rookie I am ..

    That worked great, thanks much for the help..

  6. #6
    Full Member TLE's Avatar
    Join Date
    January 21st, 2005
    Location
    Southern California
    Posts
    338
    Great :-)

    I believe that the % wild card is only applicable to HAVING/WHERE qualifiers.

    Tuan

  7. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Bing Site: Command Question, Number Of Pages Showing Up
    By Trust in forum Search Engine Optimization
    Replies: 6
    Last Post: July 19th, 2011, 06:17 PM
  2. Using xml to UPDATE my mySQL database. tricky!
    By halifaxer in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: February 20th, 2008, 10:20 PM
  3. Database of datafedds how to update - mysql
    By dflsports in forum Programming / Datafeeds / Tools
    Replies: 7
    Last Post: December 21st, 2005, 01:14 PM
  4. Update mysql rows with checkboxes
    By mobilebadboy in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: January 26th, 2005, 09:27 PM
  5. Error 1148 command not allowed with this MySQL version
    By Jane in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: April 17th, 2004, 03:42 PM

Posting Permissions

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