The SQL statement in mysql_query () does not seem to contain parentheses.

Source: Internet
Author: User
The SQL statement in mysql_query () does not seem to contain parentheses. $ Rs = & nbsp; mysql_query ("select & nbsp; * & nbsp; from & nbsp; cxjb2 & nbsp; where & nbsp; nam & nbsp ;". the SQL statement in $ _ POST [se mysql_query () does not seem to contain parentheses.
$ Rs = mysql_query ("select * from cxjb2 where nam ". $ _ POST [select3]. "$ _ POST [nam] and cat ". $ _ POST [select0]. "$ _ POST [cat] and sha ". $ _ POST [select1]. "$ _ POST [sha] and pri is NULL or nam ". $ _ POST [select3]. "$ _ POST [nam] and cat ". $ _ POST [select0]. "$ _ POST [cat] and sha ". $ _ POST [select1]. "$ _ POST [sha]");

The preceding statement can be executed.

$ Rs = mysql_query ("(select * from cxjb2 where nam ". $ _ POST [select3]. "$ _ POST [nam] and cat ". $ _ POST [select0]. "$ _ POST [cat] and sha ". $ _ POST [select1]. "$ _ POST [sha]) and (pri is NULL or pri is not null )");

When the same logical relationship is converted to this statement, it cannot be successfully executed.

Please kindly advise




Share SQL:
------ Solution --------------------
All SQL commands must begin with SQL commands.

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.