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 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 30, 2008 Share Posted May 30, 2008 Where do you store the username? Sessions? Quote Link to comment 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 Quote Link to comment 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?? Quote Link to comment Share on other sites More sharing options...
Pavlos1316 Posted May 30, 2008 Author Share Posted May 30, 2008 NO i use session_regenerate_id Quote Link to comment 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']; Quote Link to comment Share on other sites More sharing options...
Pavlos1316 Posted May 30, 2008 Author Share Posted May 30, 2008 ok i will try it.. thanks Quote Link to comment 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']? 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.