Linking each Foreach output individually from database

Hey there guys. I’m almost finished reading through Build Your Own Database Driven Website Using PHP and MYSQL by Kevin Yank (really informative book) and I have a question.

When I’m outputting data from a database list with a Foreach statement how do I make each output link to it’s individual page.

For example.http://www.animenewsnetwork.com/encyclopedia/anime.php . Here you click on a letter and there is a dropdown list of all the Anime corresponding with each letter and each of the titles goes to their own individual page.

How do I go about coding something like this, having each output link to it’s own page? I’m trying to do something similar only with classic games.

Anyone out there who can help?

You would need to pass to the query’s WHERE CLAUSE via the $_GET the letter you want to search for, the URL would look something like:

www.madeupsitename.com?seach=a

You would access the value for search by $_GET[‘search’]

The value for search would need to be sanitized ( NEVER TRUST ANY USER INPUT ), at the very least with mysqli_real_escape_string() ideally you shoud use prepared statements to prevent SQL injection attacks,[URL=“http://uk3.php.net/manual/en/security.database.sql-injection.php”] see here for more info.

Thanks for the response.
I definitely use mysqli_real_escape_string amongst others in a custom function to prevent MYSQL Injections.

However.
Say, I click the letter “a”, the list gets presented with all of the “a” titled videogames. How do I make it now that if I click on the “Actraiser” game it goes to the “Actraiser” page, and if I click on the “Animaniacs” game it goes to the “Animaniacs” page. These are just examples, but I hope you can give some more insight on how to do this.

So basically once I have my list I want each individual item to link to it’s own page.

Thanks a lot.