Why can't I display user information?

Source: Internet
Author: User
The code is in index_ok.php.
$sqlstr = "Select Emp_id,emp_accounts,emp_password,emp_name,department from Employee where emp_accounts= '". $_post[' Name ']. "' and emp_password= '". $_post[' pwd ']. "'"; $select = mysql_query ($sqlstr, $conn); $record = Mysql_fetch_row ($select); $record = Mysql_fetch_row ($select); $_session [' emp_id '] = $record [0]; Get user number $_session[' emp_accounts ' = $_post[' name '];//get user login account $_session[' emp_name '] = $record [3]; Get the user name $_session[' Department ' = $record [4]; Get the User department echo "";

[Code=php[/code]
The following code is in emp_main.php. I want to display the user information on this page!
 
  
 
  
 
  
 
  

I can successfully login ah, why I can't display user information ah? I'm a beginner of PHP, and I've put my understanding on top of it. Their information is in the form of employee.


Reply to discussion (solution)

$record = Mysql_fetch_row ($select);
There were two.

Generally speaking, users with the same name will not appear in the user system.
So there will only be one record in the result set $select
When you read two times, you will not be enrolled for the second time, and of course it is not displayed.

$record = Mysql_fetch_row ($select);
There were two.

Generally speaking, users with the same name will not appear in the user system.
So there will only be one record in the result set $select
When you read two times, you will not be enrolled for the second time, and of course it is not displayed.
There's only one, and I copied it more.

$record = Mysql_fetch_row ($select); Cut this one out.

You don't give the right information, and naturally you don't get the right answer!

The following possible question you may also say is that you have noticed, but did not post the
No session_start ();

You don't give the right information, and naturally you don't get the right answer!

The following possible question you may also say is that you have noticed, but did not post the
No session_start (); I don't really have one.

You don't give the right information, and naturally you don't get the right answer!

The following possible question you may also say is that you have noticed, but did not post the
No session_start (); Why should there be session_start ()?

You don't give the right information, and naturally you don't get the right answer!

The following possible question you may also say is that you have noticed, but did not post the
No session_start (); Plus, I can't even lose it.

Both sides need to add session_start (); Did you add it?

Both sides need to add session_start (); Did you add the add-on?

Add to it, add it at the beginning?
Two pages are Print_r ($_session); Look

Session_Start (); Question, where did you add it?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.