Jump to content

[SOLVED] PHP Embeded Variables


conquest

Recommended Posts

Hey there,

This is my first time on the forum so gimme a break if sayin somethin stupid lol.

 

ok so im trying to create a list of users using php, and with that i have no problem, but what i need is a link associated with each one that can store a unique variable for each record to be passed to the next page.  e.g. list of 20 users displayed, when a user is selected, it takes you to their profile, so if user 8 was selected, user 8's id would be passed to the next page to call up related values in thier profile.

 

heres the code i have so far:

 


<?PHP


// Make a MySQL Connection
$query = "SELECT * FROM users ORDER BY 'userid' DESC"; 

$result = mysql_query($query) or die(mysql_error());

echo "<table width=400 border=0>";
echo "<th width=100> Battle </th>" . "<th width=100> User ID </th>" . "<th width=100> Level </th>" ."<th width=100> Username </th>" ."<th width=100> Alignment </th>";
while($row = mysql_fetch_array($result)){

echo "<tr><td>" . " <a href=battleplayer.php?id=" . $row['userid'] . "> Battle </a>" . "</td><td>". $row['userid']. 
                    "</td><td>". $row['level']. " </td><td> ". $row['username']. " </td><td> ". $row['alignment'];


}
echo "</td></tr></table>";

?>
</div>

 

The problem so far lies in the following section where the hyperlink is created:

 

echo "<tr><td>" . " <a href=battleplayer.php?id=" . $row['userid'] . "> Battle </a>" . "</td><td>". $row['userid']

 

Greatful for any help   :)

Link to comment
https://forums.phpfreaks.com/topic/124229-solved-php-embeded-variables/
Share on other sites

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.