Jump to content

Giving a page it's "unique" id.


u214

Recommended Posts

Hello guys. I'm so sorry if y'all feel like I'm bothering with this noob threads.

 

I'm making a dynamic stats signature using info my mysql.

 

It currently is working like its supposed to. But i want to have an image of a player's stats of each player. For example. A player types in the URL:

 

www.test.com/stats.php?user=Username

Now, when a player accesses that url, the default stats image will be show, and for stats. I want the "Username" to be the query and that gets the info.

 

For example:

 

mysql_query("SELECT * FROM players WHERE user = '$usernamehere'

 

How can i detect the url username though?

 

This is my current set up:

mysql_query("SELECT * FROM players WHERE user = 'test'      - It's working.

But i want to use variable and give that "Username" ( From url ) it's stats.

 

Here's my current code:

<?php
$imagepath="css/images/dog.JPG";

$image=imagecreatefromjpeg($imagepath);

$imgheight=imagesy($image);

$color=imagecolorallocate($image, 255, 255, 255);

include("config.php");
$result = mysql_query("SELECT * FROM playerinfo WHERE user = 'Test'", $connect);

while($myrow = mysql_fetch_row($result))
{
	// Not working properly.
	imagestring($image, 5, 50, $imgheight-50, $myrow[0], $color);
	imagestring($image, 3, 30, $imgheight-30, $myrow[2], $color);
}

// This line works like it should:
//imagestring($image, 5, 50, $imgheight-50, "Using it like this works!", $color);

header('Content-Type: image/jpeg');

imagejpeg($image);

?>

Link to comment
https://forums.phpfreaks.com/topic/235217-giving-a-page-its-unique-id/
Share on other sites

You would have to set up like a file directory called Members.

 

When a user would sign up to your site you would create a new folder for that member in the Members directory.

 

Then it would come into work for the application you have here. You would simply pull up the image from the Members/username/profile_pic.jpg for example. Something like that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.