Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    Walsall - UK
    Posts
    177

    PHP+mySQL... adding a number to an existing number

    Hey guys

    Say I have a number in the database e.g. 5

    I have a variable in PHP thats 4.. I want to add that to the 5 in the database and make it 9...

    Ratehr than getting the current number in the database, handling it with PHP, then putting the new one in..

    Is there a way?

    Thanks in advance

    crE
    <<< Please see Forum Guidelines for signature setup. >>>

  2. #2
    Join Date
    Dec 2002
    Location
    The Shadows
    Posts
    2,925
    mysql_query("UPDATE `tablename` SET number=number+".$phpnumber." WHERE number=5"); Should work
    Dan Sheppard ~ Freelance whatever

Posting Permissions

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