PHP Judgment Statement

Source: Internet
Author: User
There is a condition that will not be written.
$username =trim ($_post[' username ');
$password =trim (&_post[' Pass ');
Declare the SQL statement that would query the database
$query = "SELECT Top 6 * from Web_view where dnbh= ' $username ' ORDER by sfmonth DESC";

Execute the SQL query and return records
$result = Mssql_query ($query) or Die ("Query data failed:". Mysql_error ());

$numRows = Mssql_num_rows ($result);
$nRow =mssql_fetch_array ($result);
if (Empty ($numRows) && $password <>substr (row[3],-4)) {echo '

No data found, please enter the user name and password correctly. Thank you!

";}
else {
Output results
}

Empty ($numRows) && $password <> substr (row[1].lenth-3,4) I mean, when the query result is empty or the user enters the password and the row[1 in the database] the last 4 characters are compared, If it is not, the error message is output, allowing the user to enter the user name and password again.
Runtime prompt error, Parse error:syntax error, unexpected ' [' in D:\WWW\test.php


Reply to discussion (solution)

SUBSTR (Row[3],-4)
should be written as
SUBSTR ($nRow [3],-4)

$numRows = Mssql_num_rows ($result);
$nRow =mssql_fetch_array ($result);
if (Empty ($numRows) | | $password <> substr (nrow[3],-4)) {echo '

No data found, please enter the user name and password correctly. Thank you!

";}

I've changed it.

Why do you always miss "$"?

  • 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.