SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    unique text entry

    On HTML page 1 I ask for a first name and last name. When the form is submitted, the first initial of the first name and full last name are combined to create a string $fullname. $fullname is entered in a MySQL database as a unique identifer. Because of the nature of the string, it can be any number of characters long (...unless theres some way to make the string...7 charachters? Which would require short names, like jlee, to have extrac character added to the end?) Anyways, how do I ensure that noone will ever have the exact same identifier. For example, if James Hawthorne and Jill Hawtorne, 2 unrelated people, fill out the form, they won't both have the identifier jhawthorne. How do I do this?

    Sketch
    Aaron Brazell
    Technosailor



  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by giving them an id number and using that as a unique identifier.
    names are never a good entity to use, as they can always be duplicated.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay, then how would I generate a unique numeric id from the HTML form? I know a new entry can generate a unique id in the db, but how does my form know any of that info and how do I verify if someone had already filled out the form?

    Sketch
    Aaron Brazell
    Technosailor



  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, if your just inserting information, your form DOESN'T need to know.
    just have mysql do an auto-increment on your id field and have it default to whatever you want to start that.
    that way whenver something's put in, it'll automatically put in a new, unique id number for that user.

    and to verify you'd just do a select query on each field and see if that info exists.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ahhh, I got it. Thank you.

    Sketch
    Aaron Brazell
    Technosailor




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
  •