Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   dynamic page url variables from database (http://www.go4expert.com/forums/dynamic-page-url-variables-database-t23414/)

pein87 25Sep2010 04:06

dynamic page url variables from database
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 4Dec2010 14:49

Re: dynamic page url variables from database
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.

All times are GMT +5.5. The time now is 16:04.