SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast eastern_star's Avatar
    Join Date
    Jul 2001
    Location
    east
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    increase the value of a cell by one

    in a row which has a unique id, i want to increase the value of a cell by one..

    example

    option_id = 55, option_value = 23;

    after getting the id, i want to automatically increase the value by one, making it 24

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To increment the value of option_value you will need an UPDATE query like this:

    UPDATE TableName
    SET option_value = option_value + 1
    WHERE option_id = 55

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean like this?

    PHP Code:
    UPDATE Table SET option_value option_value 1 WHERE option_id '55' 
    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [SNAP!]

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bloody hell Sid, that's twice in 5 minutes

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    SitePoint Enthusiast eastern_star's Avatar
    Join Date
    Jul 2001
    Location
    east
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you ARE incredible...

    (both of you)



Bookmarks

Posting Permissions

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