Hi evryone , I'm working in a program for storing inbox and outbox documentsand and in mysql the sn number is the primary key. the number must be as 01/2006 the next nuber will be 02/2006 my problem is how can i make this sequance number start from 1 when the year will come 2007 and the first number will be 01/2007 and also for the next years>> Any help regarding this will be highly appreciated.
thank you Nikolas but not that wat i want. for exampe the following number> 112/2006 122 is the nember of the document no the month and it will be auto_increment 2006 is the year and i want the number of document starting from 1 when the uear be come 2007 >>>> and agein it will start from 1 when the new year come
Let's say that you keep the higher id in a variable called $max, and the maximum recorder year (eg. 2006) in a variable called $mYear. Then : $newID = (date('Y') == $mYear ? $max++: 1); PHP: