By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

failed to retrieve data?

P: 18
hi....i am making a system using php. after user had register their account, they will be proceeded to menu.php page. I want this page to be able to retrieve the data that have been entered by user.

For example....

Name : <their name that they entered during registration>

Department : < user's department >

I had succeed to retrieve their name..but the problem is,other information could no be retrieve,such as phone number,position in company etc.


this is my coding.....


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. if(isset($_SESSION ['username']))
  4. {
  5. ?>
  6. <html>
  7. <body>
  8. Hi, <?php echo $_SESSION['username']; ?> [<a href="logout.php">Logout</a>]
  9. <br><br>
  10. <?php echo    "SENARAI TUGAS HARIAN"; ?>
  11. <br><br>
  12. <?php echo $_SESSION['username']; ?> //success to retrieve
  13. <?php echo $_SESSION['position']; ?> //failed
  14. <?php echo $_SESSION['department']; ?> //failed
  15.  
  16. <br><br>
  17. <br><br>
  18. <br><br>
  19. <br><br>
  20. <br><br>
  21.  
  22. </body>
  23. </html>
  24. <?php
  25. }
  26. else{
  27. header("Location: login.php");
  28. }
  29. ?>
Dec 22 '11 #1
Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
you probably didnít write those (failing) data. we would need to see the cade, where you save the data to the session.
Dec 22 '11 #2

P: 18
hi dormilich...thankz for informing me about the CODE tag....
you said that you would need to see the cade, where i save the data to the session.

do you mean the database?
Jan 4 '12 #3

Dormilich
Expert Mod 5K+
P: 8,639
I mean the code where you save the data into the session. if you save the data into a database and not a session, then you obviously can’t get those data out of the session.
Jan 4 '12 #4

P: 18
hello dormilich....tq so much...now i know why i can't retrieve those data.....coz i save it in database....it's my mistake.....
Jan 5 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.