emtor Posted May 23, 2007 Share Posted May 23, 2007 I'm a php newbie in the process of malking a php/mysql website where each registered member has a profile page. This is what I'm trying to achieve: -When some member visits someone else, I want that someone to see the recent visitor's username on his/her profile page. Can someone give me some hints on how this could be done? Quote Link to comment Share on other sites More sharing options...
chigley Posted May 23, 2007 Share Posted May 23, 2007 I'd do it by running a query on each profile view which updates a field (maybe called lastvisitor) in the user who owns the profile's row with the value of their last visitor. Quote Link to comment Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 agreed... just on the table that holds that profile, put a lastviewer column, which updates to the last person(id/username, or whatallelse you want) who's seen it :-) Quote Link to comment Share on other sites More sharing options...
emtor Posted May 23, 2007 Author Share Posted May 23, 2007 The problem is, I don't have the slightest idea what to update the column with. I guess I'd need some kind of variable that holds the visiting user's ID or username or whatever? Quote Link to comment Share on other sites More sharing options...
chigley Posted May 23, 2007 Share Posted May 23, 2007 Yeah. In your code, is the username session value stored as an ID or username? Just use whatever you use there. Quote Link to comment Share on other sites More sharing options...
trq Posted May 23, 2007 Share Posted May 23, 2007 Assuming your visitors are logged in and have a variable $_SESSION['uid'] (as example) set, use that. Quote Link to comment Share on other sites More sharing options...
emtor Posted May 23, 2007 Author Share Posted May 23, 2007 Yes, you're right . . . $_COOKIE['ID_my_site'] . . . I'll use that then . . . thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.