Jump to content

PHP URL Help


Rhubarb

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

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.