Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto generate ID number for new entries in a MySQL DB

    I'm creating a script that adds certain information into a database, the table in the DB has a field for "ID" but I don't want the user to enter this info, I want it to be generated automtically and inserted into the DB. How can I go about doing this.

    ps. This is my first PHP script, please don't assume I know more than an beginner

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    You set the ID field as PRIMARY_KEY and use auto_increment. You can do it with phpmyadmin.
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #3
    New Coder
    Join Date
    Jul 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers, thanks for that


  •  

    Posting Permissions

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