Jump to content

PHP/mysql insert incrimental number in PK


cjkeane

Recommended Posts

I need to create a custom PK similar to 000111-GH.

where:

0001 is the counter

11 is the year

GH i need randomly generated with either numbers/letters

 

once 2012 occurs, i need the counter to be reset to 000112-DF

How would i increment 0001 until 2012, then reset the first few digits back to 0001?

 

similarly, i will have a linked table but will have a different autonumber format

for client 1 the linked data would look look like this

000111-GH-001 for record 1

000111-GH-002 for record 2

 

but then for client 2

000211-DS-001

00211-DS-002

 

Can anyone provide any assistance on how to accomplish this?

thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.