When closing the database, a syntax error is Prompted. thank you!

Source: Internet
Author: User
When closing the database, a syntax error is Prompted. for new users, thank you for Parse error: syntax error, unexpected T_OBJECT_OPERATOR in F: \ www \ study \ authmain. php on line.

Session_start ();

If (isset ($ _ POST ['userid']) & isset ($ _ POST ['password'])
{
$ Userid = $ _ POST ['userid'];
$ Password = $ _ POST ['password'];

$ Db_conn = new mysqli ('localhost', 'webauth ', 'webauth', 'auth ');
If (mysqli_connect_errno ()){
Echo 'connection to database failed: '. mysqli_connect_error ();
Exit ();

}

$ Query = 'select * from authorized_users where name = '. $ userid. "and password = sha1 (' $ password ')";
$ Result = $ db_conn-> query ($ query );
If ($ result-> num_rows)
{
$ _ SESSION ['valid _ user'] = $ userid;
}

$ Db_conn-> close ();


}
?>


Reply to discussion (solution)

Which line of error is prompted?

Indicate the wrong row number

Last line close

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in F: \ www \ study \ authmain. php on line 23

A semicolon is added at the end.

An error is written. there is an extra parenthesis, and the final parenthesis is removed.

An error is written. there is an extra parenthesis, and the final parenthesis is removed.

Thank you!

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.