What should I do if an error occurs when I create a phpsession object?
Source: Internet
Author: User
Error in phpsession object creation & lt ;? Phpheader (& quot; content-type: text/html; charset = utf-8 & quot;); include (& quot; conn. php & quot;); & nbsp; session_start (); $ Loname = trim ($ _ POST [php session object creation error
Header ("content-type: text/html; charset = utf-8 ");
Include ("conn. php ");
Session_start ();
$ Loname = trim ($ _ POST ["Loname"]);
$ Lopass = trim ($ _ POST ["Lopass"]);
$ Losx = trim ($ _ POST ["Losx"]);
$ Locode = trim ($ _ POST ["Locode"]);
If (strlen ($ Locode) <= 0 ){
Echo "Enter the verification code ";
Exit;
}
If (trim ($ _ SESSION ['validationcode'])! = $ Locode ){
Echo "incorrect verification code input ";
Exit;
}
If (strlen ($ Loname) <= 0 ){
Echo "enter the user name ";
Exit;
}
If (strlen ($ Lopass) <= 0 ){
Echo "enter the password ";
Exit;
}
If (strlen ($ Losx) <= 0 ){
Echo "enter the password ";
Exit;
}
If ($ Losx! = "First_admin ")
{
Echo "BCC error ";
Exit;
}
Mysql_query ("set names utf8 ");
Mysql_select_db ("first_data", $ con );
$ Lopassx = md5 ($ Lopass );
$ SQL = "select * from admin_infox where admin_name = '$ loname' and admin_pass =' $ Lopassx 'and ck_working = 1 ";
$ Result = mysql_query ($ SQL );
$ Row = @ mysql_num_rows ($ result );
If (! $ Row ){
Echo "account information error ";
Exit;
}
Else
{
$ _ SESSION ['admin _ namex '] = $ result ("admin_name ");
$ _ SESSION ['admin _ power'] = $ result ("admin_powerx ");
$ _ SESSION ['admin _ cking'] = "working"; header ('Location: index_home.php ');
}
Mysql_close ($ con );
?>
An error is reported when the session is created after the user is verified.
Fatal error: Function name must be a string in D: \ wamp \ www \ first_line \ administrators \ inc \ login_ck.php on line 49
Thank you!
------ Solution --------------------
$ Result ("admin_name"); this is incorrect. $ Result is not a resource set,
------ Solution --------------------
$ Result is a database resource identifier, so you should mysql_fetch_assoc ...... Get Data
Then get $ result ("admin_name"); the array element subscript uses []
------ Solution --------------------
$ Rowx ["admin_name"]; the following is the same.
------ Solution --------------------
$ Row = mysql_fetch_assoc ($ result );
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.