1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySql Error 1093 You can't specify target table 'x' for update in FROM clause

Discussion in 'MySQL' started by Fahd, Apr 23, 2008.

  1. #1
    Hi Guys,

    This is what I need to accomplish...

    UPDATE links SET out=out+1 WHERE id = (SELECT id FROM links WHERE url = '$url')
    PHP:
    But mysql gives...

    What is the best alternate way to achieve this?

    Thanks in advance! :)
     
    Fahd, Apr 23, 2008 IP
  2. Petey

    Petey Peon

    Messages:
    68
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi Fahd,

    I might be missing something but wouldn't:

    UPDATE links SET out=out+1 WHERE url = '$url'

    work for you?
     
    Petey, Apr 24, 2008 IP
  3. Fahd

    Fahd Well-Known Member

    Messages:
    2,152
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    100
    #3
    Petey,

    You're not missing a damn thing. I'm stupid! :eek:

    Thanks! :)
     
    Fahd, Apr 24, 2008 IP
  4. Petey

    Petey Peon

    Messages:
    68
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi Fahd,

    Glad I could help. You're not stupid - a stupid person wouldn't ask for help.

    Petey
     
    Petey, Apr 24, 2008 IP
  5. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #5
    Well said.
     
    mwasif, Apr 24, 2008 IP