SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot XzAzX's Avatar
    Join Date
    Apr 2002
    Location
    Holland
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    update DB variable?

    I'm busy with php and MySQL, and I need to know how to add an value to an variable like set an variable +30 or so....
    thx!

  2. #2
    SitePoint Zealot XzAzX's Avatar
    Join Date
    Apr 2002
    Location
    Holland
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pleaze, I'm busy with an online game an need this!
    thx!
    _o_ OOP _o_

  3. #3
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here's the query:
    Code:
    UPDATE character_stats SET agility=agility+30;
    where character_stats is the table name and agility is the field you want to increase

  4. #4
    SitePoint Zealot XzAzX's Avatar
    Join Date
    Apr 2002
    Location
    Holland
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YES IT WORKS!!!
    THX A LOT M8IE!!!!
    _o_ OOP _o_

  5. #5
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you're welcome

    just wondering: do you know a certain XxProxX? or are you him? just the familiar name pattern...

  6. #6
    SitePoint Zealot XzAzX's Avatar
    Join Date
    Apr 2002
    Location
    Holland
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope sorry, don't know him .

    btw look: I thanked u :P
    then go a bit down at the MAIN frame(the biggest )
    Last edited by XzAzX; Apr 5, 2002 at 20:35.
    _o_ OOP _o_

  7. #7
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    from your website
    YEEHAW!!!!!
    Thx to redemption from http://www.sitepointforums.com
    the webmaster now knows how to increase values
    of an variable in the database!!!
    lol... thanks...

  8. #8
    SitePoint Zealot XzAzX's Avatar
    Join Date
    Apr 2002
    Location
    Holland
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nother question :
    How can I print an text, only if the variabele hp from the database is lower then 0 ?
    thx!
    _o_ OOP _o_

  9. #9
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How can I print an text, only if the variabele hp from the database is lower then 0 ?

    PHP Code:
    $query="SELECT hp FROM your_table WHERE hp < 0";
    $result=mysql_query($query);
    if(@
    mysql_num_rows($result))
    {
      echo 
    "Your are now officially dead...";  // this is the text message to echo

    you may want to further limit your WHERE clause depending on your table structure

  10. #10
    SitePoint Zealot XzAzX's Avatar
    Join Date
    Apr 2002
    Location
    Holland
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes works 2!
    thx again!
    _o_ OOP _o_


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
  •