hello guys im new php developer ryt now i have a have project my project is online ticketing system.. the one of my problem is incrematation and inserting number to mysql..for example i want to store number to mysql in this format 00000001 to 10000000 and if the year is change the number is go back to 00000001 and also if the number reach the max. is also go back to 00000001. please help me.. many thanks to all want to help me
Your want str_pad $i = str_pad($i, 8, "0", STR_PAD_LEFT); PHP: This will take $i (your number) and turn it into an 8 character string filled with leading zeros. As far as the other part, it will just depend on the logic you want to use. Usually comparing the date of the two (in Unix time) is best for the year-to-year comparison.