Why the session value is NULL

Source: Internet
Author: User
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.
  • 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.