Jump to content

[SOLVED] dynamic url with auto_increment


kidintraffic

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.