Advanced Search

Results 1 to 5 of 5

Thread: Script to post a number then another number

  1. #1
    Join Date
    Nov 2011
    Location
    Sweden
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Script to post a number then another number

    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.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2011
    Location
    Sweden
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    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.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. The Following User Says Thank You to djr33 For This Useful Post:

    PatrikIden (02-11-2012)

  6. #5
    Join Date
    Nov 2011
    Location
    Sweden
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •