Jump to content

Recommended Posts

I have a database that has an auto_increment for an ID field.  I am trying to create a page that lists everything in the database (people) and I want to dynamically create links on their last name but use the ID that has been assigned to them.  The link will then take them to another page that has more details of the person selected.

 

I have the basic idea.  But I don't understand to assign the id number to the query string and then display the results on the second page based on the id number.

Link to comment
https://forums.phpfreaks.com/topic/49106-solved-dynamic-url-with-auto_increment/
Share on other sites

When you retrieve data to display the lisst of people, also retrieve the record id.  Add a link that looks like a href='show.php?id=X' where X is the record id and show.php is the script to display the full record.

 

In show.php, the value of id is in the $_GET array as $_GET['id']. Use that value to retrieve specific records from the database for display using a WHERE id='$id' clause in the db query.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.