pakzyu Posted February 25, 2012 Share Posted February 25, 2012 i need to display the fullname and email of the logged in user. <?php session_start(); mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("db_register") or die(mysql_error()); $query = "SELECT` fullname`, `email` FROM `members` WHERE `username`='".$_SESSION['user']."' LIMIT 1"; if($doQuery = mysql_query($query)) { if(mysql_num_rows($doQuery)) { $user = mysql_fetch_assoc($doQuery); print_r($user); } else { echo 'No result returned for the query: '.$query; } } else { echo 'The following query failed: '.$query; } $id = $user['id']; $fullname = $user['fullname']; $email = $user['email']; } ?> <br> Fullname : <?php echo $fullname; ?> <br> Email : <? echo $email; ?> ?> HELP please . Quote Link to comment https://forums.phpfreaks.com/topic/257767-displaying-information-of-a-logged-in-user/ Share on other sites More sharing options...
Pikachu2000 Posted February 25, 2012 Share Posted February 25, 2012 That's great. Do you have a question or specific problem we can help with? Quote Link to comment https://forums.phpfreaks.com/topic/257767-displaying-information-of-a-logged-in-user/#findComment-1321167 Share on other sites More sharing options...
pakzyu Posted February 26, 2012 Author Share Posted February 26, 2012 That's my current code but it does not work. i'm trying to display the fullname & email of the logged in user. by the way im using sessions for the user to log in. Quote Link to comment https://forums.phpfreaks.com/topic/257767-displaying-information-of-a-logged-in-user/#findComment-1321358 Share on other sites More sharing options...
trq Posted February 26, 2012 Share Posted February 26, 2012 Define "does not work". Quote Link to comment https://forums.phpfreaks.com/topic/257767-displaying-information-of-a-logged-in-user/#findComment-1321369 Share on other sites More sharing options...
pakzyu Posted February 26, 2012 Author Share Posted February 26, 2012 oh i'm sorry. i made some changes and it's now working. thanks by the way . Quote Link to comment https://forums.phpfreaks.com/topic/257767-displaying-information-of-a-logged-in-user/#findComment-1321376 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.