Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8479003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:54:18+00:00 2026-06-10T18:54:18+00:00

After reading through possible options here on Stackoverflow, I don’t see an answer for

  • 0

After reading through possible options here on Stackoverflow, I don’t see an answer for the exact case I’m considering…

CASE: I have a php system that auto-generates mysql-connected templates.

In order for the system to work, I need each generated template to have a unique 6-digit integer assigned upon it’s creation. Instead of messing with randomizers, etc…

A) could I simply create a table in the database called ‘pageid’, with int(11) / unique / autoincrement with starting value 100000, and then during the template creation process, simply perform an insert on this table, and then a ‘select last_insert_id()’ to pull the last value, which is then injected into the template as it’s created? (in otherwords, the table’s only function is to generate and spit back the last unique id).

B) if so, are there any issues I should be concerned about using this method? (aside from the fact that it means a limit of only 899,999 templates can be generated – which is not an issue in this case).

Any thoughts or better methods appreciated…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:54:19+00:00Added an answer on June 10, 2026 at 6:54 pm
    1. could I simply create a table in the database called ‘pageid’, with int(11) / unique / autoincrement with starting value 100000, and then during the template creation process, simply perform an insert on this table, and then a ‘select last_insert_id()’ to pull the last value, which is then injected into the template as it’s created? (in otherwords, the table’s only function is to generate and spit back the last unique id).

      Yes:

      CREATE TABLE pages (
        pageid MEDIUMINT(6) NOT NULL AUTO_INCREMENT PRIMARY KEY
      ) AUTO_INCREMENT = 100000;
      

      Note that I am using MEDIUMINT(6) as it requires 1 byte less storage than INT and has a more appropriate display width for your needs.

    2. if so, are there any issues I should be concerned about using this method? (aside from the fact that it means a limit of only 899,999 templates can be generated – which is not an issue in this case).

      You could instead just have that column in your templates table, and have the id automatically assigned whenever a new record is inserted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling the answer is no after reading through documentation. However, I
After reading this question I started to wonder: is it possible to have a
I have gone through the following tutorial : http://www.javaworld.com/community/node/2915 And after reading the above
I've spent the morning reading through page after page of StackOverflow posts about this
After reading answer to this question: Make "make" default to "make -j 8" I
after reading the cookbook and various Q&A here I am still a bit confused
Possible Duplicate: !function(){ }() vs (function(){ })() So I was just reading through the
After reading through various tutorials [1] I still can't get my VirtualHost settings to
I am trying to learn ASP.NET MVC. After reading through many articles on the
Beginner programmer here. after a bunch of reading about 'variables' which dont exist in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.