I’ve made my search form with html and jquery. When I input a name into the search field, and click search, it checked the MySQL database i specified, and displays any names containing the text in the search field. the url is localhost/players.html because I’m testing it on apache at the moment, and its for a game server player statistics page.
I have the results showing how I want them, in a table with certain information displayed in the columns.
When a result is clicked, I want to display the players statistics on a new page, but I don’t want to create and store thousands of pages one for each registered player. So I want it to create a virtual page, or something like that. Where the link is clicked, the URL would be something like /players/PlayerName.html or if that isn’t possible maybe players.php?action=getstats(PlayerName) I’m not really sure how to do this or if it’s possible.
I want it to work so that if I was to type http://www.myurl.co.uk/players/PlayerName.html it would show the statistics page for that player, without the html page actually e xisting.
Do it like this
Create one page called “player.php”, this page will receive parameter UserID.
So in you high score table add link for each player to point to this page with the parameter UserID
when clicked it will go to player.php and you can get your parameter through global $_GET variable like this
So in you page just select data for that user
just remember to mysql_escape $player_id before adding it to query in order to avoid SQL Injection
That is easy way, you can do it also with the URL rewriting apache module in order to get friendly URLs like /player/stat/nick-name
but that is more work if your system doesn’t support this.