How to predefine ID number using PHP ? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

How to predefine ID number using PHP ?

I want create a database where ID number supposed to be (current date + n) like 2703191-2704192-2703193... -270319n...

27th Mar 2019, 7:43 AM
M.N. Sadik
M.N. Sadik - avatar
1 Réponse
+ 2
Why do you want to do something like that ? I think it is better to use two separate fields one to save the id (auto increment field , indexed column as primary key) and one to save the current date. ---------------- If you want something like that you describe I think that you have to create a sequence. And then create a trigger after insert for each row to set the concatenated value you want.
27th Mar 2019, 8:31 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar