Pavlos1316 Posted May 30, 2008 Share Posted May 30, 2008 Hi I have a form that only members can submit. How do I get their username in my db when they submit the form? Thanks Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/ Share on other sites More sharing options...
DarkWater Posted May 30, 2008 Share Posted May 30, 2008 Where do you store the username? Sessions? Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553852 Share on other sites More sharing options...
Pavlos1316 Posted May 30, 2008 Author Share Posted May 30, 2008 I store it in my registration db Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553858 Share on other sites More sharing options...
peranha Posted May 30, 2008 Share Posted May 30, 2008 How do you store it in the website so you know they are logged in, or dont you store the username?? Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553860 Share on other sites More sharing options...
Pavlos1316 Posted May 30, 2008 Author Share Posted May 30, 2008 NO i use session_regenerate_id Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553861 Share on other sites More sharing options...
runnerjp Posted May 30, 2008 Share Posted May 30, 2008 ok so do something like this $id= session_regenerate_id $query = "SELECT * FROM table WHERE ID = '$id' LIMIT 1"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $user = $array['Username']; Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553862 Share on other sites More sharing options...
Pavlos1316 Posted May 30, 2008 Author Share Posted May 30, 2008 ok i will try it.. thanks Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553863 Share on other sites More sharing options...
DarkWater Posted May 30, 2008 Share Posted May 30, 2008 Pavlos, how do you actually store the username in the session? $_SESSION['username']? Link to comment https://forums.phpfreaks.com/topic/108050-collect-username-automatically/#findComment-553867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.