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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.