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?