Jump to content

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


man5
Go to solution Solved by 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

  • Solution

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

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.