July 27, 200818 yr hi all i am trying to create a session for all the infomation in mysql database i can create the session from the login infomation giving me the username what i am trying to do is create a classifieds page which is working as i want except the seller needs to type there email username and other details as well,i want is so that the user just needs to enter the name of the item for sale description and 3 photos without having to retype the email username telephone number etc any ideas thanks again
July 27, 200818 yr I will assume that you have a "users" table that has fields similar to: user_id (int) first_name (varchar) last_name (varchar) email (varchar) password (varchar) When the user logs in you will run a query to authenticate them with a username and password. if the user is authenticated store the "user_id" in a session $_SESSION['user_id'] You can then look up the data for that user_id in your table any time you like by doing something a bit like this: $strSQL = "SELECT first_name, last_name, email FROM users WHERE user_id ='".$_SESSION['user_id']."'"; Don't forget to include session_start() at the top of your script.
July 27, 200818 yr Author I will assume that you have a "users" table that has fields similar to: user_id (int) first_name (varchar) last_name (varchar) email (varchar) password (varchar) When the user logs in you will run a query to authenticate them with a username and password. if the user is authenticated store the "user_id" in a session $_SESSION['user_id'] You can then look up the data for that user_id in your table any time you like by doing something a bit like this: $strSQL = "SELECT first_name, last_name, email FROM users WHERE user_id ='".$_SESSION['user_id']."'"; Don't forget to include session_start() at the top of your script. thanks for this i add managed to work it out from books thanks for the reply though
Create an account or sign in to comment