vividona Posted May 5, 2009 Share Posted May 5, 2009 hi friends, plz someone explain this for me: I have user table. I fetched all data in this table nicely. Then I put the names of usernames in a shape of links. Till here all work good. But as I said I put usernames in links. I need when I click on any username link. extract the full data of this username. e.g. edit the account, change password, change email etc. Link to comment https://forums.phpfreaks.com/topic/156950-extract-username-data/ Share on other sites More sharing options...
Ken2k7 Posted May 5, 2009 Share Posted May 5, 2009 The link for the username should take you to another PHP file, passing along the userid of the user. Of course, I hope you have a unique ID field for each user or this won't work. If you don't have that field, please read up on DB normalization. In that PHP file, use $_GET superglobal to get the userid and then query the DB for info about that user id. Example (this is just a rough sketch and it is by no means a full code. So if you choose to copy and paste, please don't badger me if it works. I do not guarantee anything) The URL - http://www.mydomain.com/userprofile.php?id=4 Say that's the URL you want to redirect the user when clicked on the username. Then create a userprofile.php. userprofile.php <?php // use $_GET to get the id field // The id field is the "id=4" part in the URL // if all goes well, $id should equal to 4. $user_id = $_GET['id']; // here's where it's up to you to query the DB Hope this helps, Ken Link to comment https://forums.phpfreaks.com/topic/156950-extract-username-data/#findComment-826701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.