PhP SQL Help!

Status
This thread has been locked.

WillFTW

Feedback score
2
Posts
219
Reactions
98
Resources
0
Hello! Currently I am in the process of creating the statistics page for my servers website. I have successfully accomplish the leaderboards although I am now struggling with creating individualized player statistics pages. Essentially I need a way to make a url like: "http://www.kmkits.com/stats/profile/user/STRING", The area that says "STRING" I'd want to be a string from a column in my SQL database. And then I'd want the page to show individualized statistics for the particular string. Hopefully someone can give me a solution!

Kind Regards,
Will.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Jack

Retired Moderator
Supreme
Feedback score
11
Posts
1,210
Reactions
1,462
Resources
0
Hello! Currently I am in the process of creating the statistics page for my servers website. I have successfully accomplish the leaderboards although I am now struggling with creating individualized player statistics pages. Essentially I need a way to make a url like: "http://www.kmkits.com/stats/profile/user/STRING", The area that says "STRING" I'd want to be a string from a column in my SQL database. And then I'd want the page to show individualized statistics for the particular string. Hopefully someone can give me a solution!

Kind Regards,
Will.
Unless you're actually using that folder structure, you'll need to modify your .htaccess to redirect such a URL to a specific PHP file.
After doing one of those two options, use this to get the URI:
PHP:
$uri = $_SERVER['REQUEST_URI'];
// $uri = "/stats/profile/user/STRING";

$name_start = strrpos($uri, "/");
// $name_start = 19;

$name = substr($uri, $name_start + 1);
// $name = "STRING";
Basically gets the last "/" and takes everything after it.
You'll want to sanitize this input before making a query out of it to avoid SQL injection attacks.
 
Status
This thread has been locked.
Top