Jump to content

Recommended Posts

Hi, sorry for the newbiness of my question! (learning for 3 days)

 

I am trying to link from a user list where a visitor will click a name on the list and be taken to that persons profile.

 

On the list I am using the following code to create the user ID link which works:

 

print "{$row['userid']}</td><td><a href='profile.php?u={$row['userid']}'>";

 

 

But what should I add the my profuile page to make sure that the correct user is identified and shown?

 

Thanks in advance...

 

 

Link to comment
https://forums.phpfreaks.com/topic/72300-php-url-help/
Share on other sites

Thanks Perad,

 

But i am obviously missing something. Here is my profile code:

 

<?php 


//start the session 
session_start(); 

//check to make sure the session variable is registered 
if(session_is_registered('myusername')){ 


} 
else{ 

//the session variable isn't registered, send them back to the login page 
header( "Location: /php/login.php" ); 
} 

$_GET['u'];
require("header.php");



$result = mysql_query("SELECT * FROM user")
or die(mysql_error());  

// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
// Print out the contents of the entry 

print "<table border='1' align='center'><tr><td>Profile For <b></b>";
print $row['fname'];

print "<br><br /></td</tr></table>";
echo "<table border='1' bgcolor='#eeeeee' align='center' cellpadding='10' bordercolor='red'>";
echo "<tr><th>First Name</th><th> Last Name</th><th>Age</th></tr>";

echo "<tr><td>";
echo $row['fname'];
echo "</td><td>";
echo $row['lname'];
echo "</td><td>";
echo $row['age'];
echo "</td></tr>";



?>

 

 

What have I missed? :)

Link to comment
https://forums.phpfreaks.com/topic/72300-php-url-help/#findComment-364560
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.