0

Hey,

I have yet another question, so here it is. I have a roster page, and i have multiple players on the page. The players each have a unique playerid stored in the database. Now what i want to do is link up their name on the roster list that has their playerid in the url. It will than link to another page, and post all the players information based on that specific id.

I believe its call parameter passing in a URL, if im right. Any way, here is the code i currently have.


CODE: http://bryan26.pastebin.com/4mK5HGk9

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by effu
0

You could use something like this at the end of your URL - ?player_id=1111
Example: http://www.website.com/profile?player_id=1111

Then in your code you would have to add:

//For the current code you have on line 18
echo "<a href='profile?playerid='".$row['player_id']."'>". $row['gamertag']. "";

For the new page where it goes when they click on it.

<?PHP
//check if the variable is set and numeric
$player_id = ( isset($_GET['player_id']) && is_numeric($_GET['player_id']) )  ? $_GET['player_id'] : 0;

//if player_id is set then create $addin variable for the sql statement
if ($player_id > 0) { 
$ADDIN = "WHERE playerid = '$playerid'"; 


//NOW for your code - it would be something similar to this on your new "DETAILS" page.

// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM roster $ADDIN");




} //if (isset($player_id))  
else 
{
 echo "You did not enter a valid player id.";
}

?>

Edited by effu: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.