Select, find value and update.

Discussion in 'MySQL' started by robg, Dec 5, 2007.

  1. #1
    Hi hope someone can help. Is it possible to find the value of something and act upon without it coming back to my php script.

    e.g.

    at moment

    mysql: SELECT value(integer) FROM table.
    php: +1 to value(integer)
    mysql: UPDATE table SET value = new integer.

    Which is fine but I'm sure mysql could do all that without it coming back to the script: Something like this perhaps:

    Mysql : UPDATE table SET (value +1)

    Have looked in a few books but can't seem to see it?

    thanks
     
    robg, Dec 5, 2007 IP
  2. codesome

    codesome Peon

    Messages:
    98
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try:
    UPDATE table SET value=value+1;
     
    codesome, Dec 6, 2007 IP