ricerocket Posted March 13, 2008 Share Posted March 13, 2008 How can I do the following: Theres a contact form which has two parts. the first part is for the public and the second is for members. The public section is fine and works how i need it but I need the member section to automatically get the name and email. The username is stored in a session but the email is stored in the database, how do I get the email from the database into a variable using the username which is in the session??? Help please I'm really lost... Quote Link to comment Share on other sites More sharing options...
priti Posted March 13, 2008 Share Posted March 13, 2008 with a help of query you can fetch the email address of username select email from user_table where username=$_SESSION['username']; is this your problem?? Quote Link to comment Share on other sites More sharing options...
ricerocket Posted March 13, 2008 Author Share Posted March 13, 2008 Yea that exactly what I need but I don't know how to turn that into a variable... How would I do that? And also if I needed to select the password which is an md5 for a registration email how would I do that? Quote Link to comment Share on other sites More sharing options...
priti Posted March 14, 2008 Share Posted March 14, 2008 i hope you are aware of mysql function availabel in PHP..... $dbconnect=mysql_connect(username,password,host); mysql_select_db("database name"); ... then use mysql_query() to execute the query and use mysql_fetch_row or mysql_fetch_array() to get the result in the php variables. regarding md5,md5 is one way encryption method. Hence you need to do md5("text value from form"); has to be used in your query something like select email from user_table where username=$_SESSION['username'] and password=md5($_POST['password']); 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.