Unique urls for individual posts in mysql database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mitman
Forum Newbie
Posts: 1
Joined: Thu Jul 09, 2009 2:09 pm

Unique urls for individual posts in mysql database

Post by mitman »

I've looked around for something similar to this, but I couldn’t find anything. I have a script that allows users to post various information (comments, name etc.) to a MYSQL database. Each post is assigned a unique id when it is entered into the database.

What I am trying to do now is retrieve that data and give each post its own unique url (For example, one post could have the url http://www.example.com/showresults.php?id=3943). If one was to go to that link, they would see a specific post and that url would be unique to that post. I understand that you have to use variables but I don’t quite get how I would go about doing this. Any help would be greatly appreciated.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Unique urls for individual posts in mysql database

Post by Christopher »

In MySQL typically you would create a Primary Key of type INT that had the autoincrement functionality. Then you can then use those values as unique identifiers for records in the table.
(#10850)
Post Reply