View Full Version : Script to post a number then another number
PatrikIden
02-11-2012, 01:39 AM
Hi i'm looking fpr a script to use with a mailform. A employee can register trow this mailform, but i want a number to be assigned to every employee.
ex, if a first employee registers this employee should bee given the number 1001 and when the second employee register he/she should bee given the number 1002 and so on.
So a script (php) that can do this and that i could include in the mailform.
Thank you.
djr33
02-11-2012, 02:33 AM
I'm not sure exactly what you're asking for. Why is this a "mailform"? Do you just mean a regular HTML "form"? If so, that's easy to do using PHP. All you need is a database and some standard commands. Then you can display (or even email) the employee number.
But I don't think you'll find something like this as a "script" because it is a fairly specific requirement-- you can make it yourself, though.
PatrikIden
02-11-2012, 06:27 PM
I'm not sure exactly what you're asking for. Why is this a "mailform"? Do you just mean a regular HTML "form"? If so, that's easy to do using PHP. All you need is a database and some standard commands. Then you can display (or even email) the employee number.
But I don't think you'll find something like this as a "script" because it is a fairly specific requirement-- you can make it yourself, though.
Hi, I just need a php script to create a a number 1001 and then each time this script is run it should look in DB what number exist, if the number 1001 exist then create number 1002 if 1002 exist then 1003 and so on.
Can you giv an example of a script like this pleas.
If i'm not clear about what i want, pleas tell me to explain further.
Thank you.
djr33
02-11-2012, 08:05 PM
If you're using MySQL it's easy (and will probably be similar for any other database package):
1. Set the 'ID' column (or whatever you want to call the "number") to AUTO-INCREMENT. You can also start it with 1001 if you want (but there's no need).
2. Add the information for each entry into the database.
3. Search for that information (eg, by employee name) and get the information you just input PLUS the automatically generated number.
4. Display that number for the user or whatever you'd like.
If you don't need to use the number (immediately) you can skip (3) and (4) and just use AUTO-INCREMENT to do this for you and not think about it again.
PatrikIden
02-12-2012, 12:29 AM
If you're using MySQL it's easy (and will probably be similar for any other database package):
1. Set the 'ID' column (or whatever you want to call the "number") to AUTO-INCREMENT. You can also start it with 1001 if you want (but there's no need).
2. Add the information for each entry into the database.
3. Search for that information (eg, by employee name) and get the information you just input PLUS the automatically generated number.
4. Display that number for the user or whatever you'd like.
If you don't need to use the number (immediately) you can skip (3) and (4) and just use AUTO-INCREMENT to do this for you and not think about it again.
Thanks i think i understand now. I'l giv it a go.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.