-1

I would like to update few columns in my database every year. I am using PHP and MYSQL.

How to update/reset the columns to specific values every year ?

I have heard that we use it with the Time stamp.

I have searched a lot about it .. nothing found.

Can someone help me ?

Thanks in Advance :)

EDIT 1 :

I am making an election system for my DBMS project.

This is how my table looks like

student table in database

I would like to refresh the register_Check and C_reg_no columns every year !!

  • 2
    Can you explain what you are trying to accomplish – Dan Apr 29 '16 at 23:30
  • 1
    The syntax for an update in SQL is `UPDATE tableName SET columnName = value;`. Note that updating a whole column with the same static value indicates a serious problem with your database design. – Julie Pelletier Apr 29 '16 at 23:37

3 Answers3

0

You can achieve the result using external script or MySQL Event Scheduler.

PHP - setup a cron job to run every year

MySQL - Event Scheduler

Community
  • 1
  • 1
dchayka
  • 1,291
  • 12
  • 20
0

Ideally you would restructure your database to handle different values for different years.

Move those columns into another table and a column for year and another as a foreign key field to link the registration info to the user info. Then you can keep track of the values for each year.

Dan
  • 10,614
  • 5
  • 24
  • 35
-1

One way is to set up an annual cron job which calls a script to reset the values.

markt
  • 903
  • 7
  • 21