vidhya Posted October 29, 2008 Share Posted October 29, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/ Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-677422 Share on other sites More sharing options...
vidhya Posted October 30, 2008 Author Share Posted October 30, 2008 what do u mean by cron job?how to do that? Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-678227 Share on other sites More sharing options...
samshel Posted October 30, 2008 Share Posted October 30, 2008 http://www.sitepoint.com/article/introducing-cron/ Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-678240 Share on other sites More sharing options...
Maq Posted October 30, 2008 Share Posted October 30, 2008 Cron jobs run scripts for you. You need to specify the frequency of how often to run these scripts, every 10 minutes, or every Sunday at 12:00 am. Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-678477 Share on other sites More sharing options...
vidhya Posted November 1, 2008 Author Share Posted November 1, 2008 In the link provided abt the illustration says the execution in linux. how do i do it in windows? how to auto start the task without linux? Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-679947 Share on other sites More sharing options...
Maq Posted November 3, 2008 Share Posted November 3, 2008 There should be a task manager where you can schedule tasks. There's tutorials on here for that but you should post in another section for that answer because this isn't PHP anymore. Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-681199 Share on other sites More sharing options...
revraz Posted November 3, 2008 Share Posted November 3, 2008 Did you say you only had 5 users in the DB? If so, just do it each time someone logs in instead. Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-681204 Share on other sites More sharing options...
vidhya Posted November 4, 2008 Author Share Posted November 4, 2008 I gave an example as 5 users....there will be n number of users.... Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-681931 Share on other sites More sharing options...
samshel Posted November 4, 2008 Share Posted November 4, 2008 Check Scheduled Tasks..as mentioned above. I think that's what u need. Quote Link to comment https://forums.phpfreaks.com/topic/130572-autoincrementing-a-num-every-year/#findComment-681973 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.