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

  • SEARCH
  • Home
  • 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 7932721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:06:09+00:00 2026-06-03T21:06:09+00:00

I have a messages table that auto increments and I simply want to able

  • 0

I have a messages table that auto increments and I simply want to able to capture the auto-incremental ID number and store it along with a randomly generated code. I would then use this code to spit out entire pages. For example, let’s say the users just updated a new message and the auto-increment message ID is 429. I want to be able to store that 429 and add a 5 digit code to the end so that message gets the 429 ID automatically but also has an identifier in its column with a code like, 429mUwIz.

I would then have a public page that would take that code and show the specific message. So if you were to go to http://www.example.com/429mUwIz, it would show you the message entered. I obviously need the 5 randomized generator so users couldn’t directly go to http://www.example.com/1, http://www.example.com/2 and abuse the system.

So what would be the best way to come up with such a code and I know that mysql_insert_id won’t work since I need the ID stored with the insert.

Attached is an example of exactly how Path has created such a system. Their letters are also case-sensitive if that helps.

https://path.com/p/2BTxys

Thanks.

EDIT: What’s the best way to create this random 5 key code also. Sorry.

  • 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-03T21:06:10+00:00Added an answer on June 3, 2026 at 9:06 pm

    You can query for it

    $r = mysql_query("SHOW TABLE STATUS LIKE 'table_name' ");
    $row = mysql_fetch_array($r);
    $Auto_increment = $row['Auto_increment'];
    

    This retrieves the next auto increment id … docs for SHOW TABLE STATUS here

    And to generate a 5 character random string use

    $rand = substr(md5(microtime()),rand(0,26),5);
    

    Uses microtime() and md5 to produce a hash and then grabs a random 5 characters ….. It doesn’t need to be unique as you are using the auto increment id with it …

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

Sidebar

Related Questions

okay, i'm setting up a multi-user chat system. i have a messages table, that
i have a stack of messages in database table. i want to send these
I have a table row that has the error message in it. <tr runat=server
I have a messaging system (very basic) that has a table like this: **MESSAGE_ID**
I have Messages and User models with corresponding tables. The Messages table has such
I have table messages | id | user_id | recepient_id | message | 1
I have a simple table maintaining messages between users. The table structure looks like
Let's say I have a table called messages with the columns: id | from_id
My problem is i have set a table auto commit false. I need to
I have a 'message' table, where users send and receive messages, pretty straight forward.

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.