Web Analytics Made Easy -
StatCounter updating all rows in mysql database? - CodingForum

Announcement

Collapse
No announcement yet.

updating all rows in mysql database?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • updating all rows in mysql database?

    I own a virtual pet site (http://starbits.5gigs.com) and I am trying to make a script that will take 2 points of hunger away from all of the pets in the database every day. I can run the script everyday useing Cron, but I have no clue where to start on the script. If all the pet's hunger points are different, how do I update them all? Help is much needed. Thanks!

  • #2
    Just run this query:

    Code:
    UPDATE
     table
    SET
     hungercol = hungercol - 2

    Comment


    • #3
      Wow! That's so much easier than I thought it would be! Here, let me test it out.

      Comment


      • #4
        Yup! It works! This is the second time you have helped me out! ^.^

        Comment

        Working...
        X