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
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.

Link to comment
Share on other sites

Thanks for your answer lalnfl, but lastkarrde's way works best.

 

Sorry for kinda "ignoring" that method lastkarrde, i thought it was just a way to escape the string :s.

 

Once again, thank you so much. It works wonders. Cheers mate!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.