fetching id from login session and populating in home page : php and mysql -


i have 'user' table contains username , password details along user_id primary key.

user( user_id(pk) , username , password , address, email) 

when login website, need fetch address , email id 'user' table based on user_id of username , populate on home web page.

please can assist me on how ?

thank you.

while validate database user_id & password set :

##index.php $username=$_post['valuefromform']; $password=$_post['valuefromform']; $result_set="select * user"; $num_rows=mysql_num_rows($result_set); if($num_rows!=0) {    $result=mysql_fetch_array($result_set);    if($username==$result['username'] && $password=$result['password'])    {        $id=$result['user_id'];        $_session['id']=$id;        header("location:index.php?uid=$id");     } } 

you can use get method value of userid.

##home.php  $getid=$_get['uid']; echo $getid; 

Comments