Jump to content

This is interesting. Displaying user's profile to other users.


man5

Recommended Posts

So I have a user profile setup where it's linked unique username using $_GET session.  That all works.  

 

Now here's a bit that I didn't think of. I can't display the same profile that I view to other users; because then the content on the profile page would be relavent to the person logged in.  For eg.

$get_username	= $_GET['user'];

if($username === $get_username) {
       
        $stmt = $dbh->prepare("SELECT * FROM users WHERE user_id = $userid");
	//display user's profile to himself only.
	
} else {

	//display user's profile to everyone else

}

My set is like that. The problem with that is, I can't get the same content to show on the the profile that's viewed by other users; because I'm using current logged in user's id to get records from mysql db.

 

 

 

Link to comment
Share on other sites

Well I have located the problem.  The way my queries are setup are that they retrive data by using current user's id and not username. So I switched to userid for the get user's profile.  All good now.

Link to comment
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.