I have a problem. I am storing projectid (varchar) as a field in this format :- DD-NNN where DD is the last two digits of the year and NNN is the next project number within that year (i.e. 09-500 is the 500th project in year 2009). The user has the ability to modify the automatically generated projectid.

Plus, there is 1 internal only project for year 2009 (09-000). This project should automatically be created at the start of a new year.

How can this be done? Please help me out !


8 Years
Discussion Span
Last Post by somedude3488

I think you are going about this the wrong way.

Just use a regular auto_increment primary key field and then store the year in the rows themselves under a 'year' column.

Or you can just store the time the project was created in the database, which you can easily derive the year from with some simple mysql or php functions. That way you also have the creation time as well as the year.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.