Why is the session value empty?
member_login_do.php
/* Member Login Processing page */
Require_once (".. /conn/conn_db.php "); Include database link file
if ($_post["Txt_username"]!= "" && $_post["txt_pwd"]!= "")
{
$name = $_post["Txt_username"]; Get the submitted user name
$pwd = $_post["Txt_pwd"]; Get the submitted password
$STR = "SELECT * from member_info where m_name = ' $name ' and M_password = ' $pwd '"; Query statements
$result = mysql_query ($STR); Execute SQL statement
if (mysql_num_rows ($result) >0)//View the number of query result rows returned
{
session_id (SID);
Session_Start (); Login successful, set session value
$_session[' member '] = $_post[' txt_username '];
Session_write_close ();
echo "";
Exit (0);
}
Else
{
echo "";
}
}
Else
{
echo "";
}
?>
Session MySQL PHP
Share to:
------Solution--------------------
session_member_check.php
Don't you need a start?
------Solution--------------------
Each program needs to have session_start (); You're only in member_login_do.php.
SID only has a value after session_start ()
------Solution--------------------
Kiss and inject.
------Solution--------------------
if (mysql_num_rows ($result) >0)//View the number of query result rows returned
{
Exit Did you get in here?
..................
You first find out whether the member_info.php jump to the member_login.php file or before the jump.