Jump to content


Photo

Simple mass update


  • Please log in to reply
2 replies to this topic

#1 master82

master82
  • Members
  • PipPipPip
  • Advanced Member
  • 182 posts

Posted 18 August 2006 - 05:24 PM

I have the field 'daysold' in my users table.

How would I go about updating this by 1 each time I run the script for all the entries in the users table? (the script will become a cron I will run at midnight each day)

I have tried in the past but it updated all the entries (users) with the same number, rather than each entry! lol

Any help would be kindly recieved :)



#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 18 August 2006 - 06:07 PM

UPDATE users SET daysold = daysold + 1
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 master82

master82
  • Members
  • PipPipPip
  • Advanced Member
  • 182 posts

Posted 18 August 2006 - 06:13 PM

But wont that update all the users entries to the same number.

eg

user 1 - 1 day old
user 2 - 2 days old
user 3 - 6 days old

will become

user 1 - 2days old
user 2 - 2 days old
user 3 - 2 days old

I could be wrong though... Ill give it a try




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users