Jump to content

autoincrementing a num every year.


vidhya

Recommended Posts

hi,

 

i have a table with 5 usersid.each user will be given a rank(1 -10) while joining.after one year completion of joining the rank of the users shd be autoincremented by itself without any triggers.(suppose a users has rank 5 while joining, the next year it shd be 6).pls help i don know how to go abt this.

is there a way to do this without any triggers.pls help me with the code.

thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/
Share on other sites

Just have another field in your database called next_rank.  When they sign up take the current date + 1 year.  When they hit that date (now() = next_rank) then you give them the next rank and increment next_rank by another year.  You could do this whenever they sign in or better yet run a cron job to check everyday.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.