Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
**i am using mysql and php**

table :

ID: auto inc
NO: int
name: varchare
date: date

Now here my ID is auto incremented which is starting from 1 and increments to ....

here the idea is the column (**NO**) i need to set it to be generated from 1 and increments
forward but every starting day of the year i want it to be start from 1.

example: year 2013

id no name date
1 10 ab 2014-01-01
2 11 cd 2014-01-02
3 12 ef 2014-01-03

when ever the year changes(2015-01-01) depends on the system time and date the application level or
database level should understand to start it from one

4 1 gh 2015-01-01
5 2 ig 2015-02-01
Now year changed to 2016-01-01

6 1 mk 2016-02-01

so where i should set the column NO to work such which out user interfere it should do by
application(PHP) or Database(mysql)

***1- do i need code it on Application(php)? --- any tutorial link
2- is it posible that database(mysql) could understand and do it?***


regards in advance
Posted
Updated 24-Apr-14 3:25am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900