dynamic page url variables from database

pein87's Avatar
Ambitious contributor
I was wondering what is the best way to do this.

I want to be able to store the variable and value in a database but use php to turn them into a url variable combo.

Ok lets say I have a database table called locations with this structure

Database Columns

  • location_type
  • location_name
  • location_image
  • location_summary
  • rpg
  • parent

I want the code to take location_type as the variable and location_name as the value

like lets says location_type has the value village and location_name would be leaf

the url would be rpg.php?rpg=naruto&village=leaf

the rpg part will be hard coded but I want to dynamically create the(highlighted in red)


from the database, does anyone know of a good way to do this?
Madhu_byke's Avatar, Join Date: Dec 2010
Newbie Member
I have a similar query, which goes this way.

I am actually printing all the records in the table and creating a href

echo "<td>" . '<a href="products.php">' . $row['SubcategoryName'] . '</a>' . "</td>";

now my problem is i need the value of the $row['SubcategoryName'] that I had clicked.