Database query problems

Source: Internet
Author: User
Tags asin
Database query problems
$ Asin =$ _ POST ['key']; $ SQL = "SELECT t. 'item _ code', t. 'package _ region', t. 'ASIN', t. 'sku ', B. 'pack _ weight '"; $ SQL. = "FROM '1 _ sku_comparison't left join '1 _ product' B on t. 'item _ code' = B. 'item _ code' "; $ SQL. = "WHERE t. 'sku '= '". $ asin. "'OR t. 'ASIN' = '". $ asin. "'OR t. 'item _ code' = '". $ asin. "'";


The problem now is when t. 'item _ code' = $ asin data can be found when the condition is met, t. 'sku '= '". $ asin. "'OR t. 'ASIN' = '". $ asin. "'when the two conditions are met, no data is found, but after I output $ SQL, the output $ SQL can be used to find data in phpmyadmin. I use ajax to upload values. what is the situation ??


Reply to discussion (solution)

Where t. 'sku '= '". $ asin. "'and (t. 'ASIN' = '". $ asin. "'OR t. 'item _ code' = '". $ asin. "')";

$ SQL. = "WHERE t. 'sku '= '". $ asin. "'and (t. 'ASIN' = '". $ asin. "'OR t. 'item _ code' = '". $ asin. "')";

T. 'sku '= '". $ asin. "'OR t. 'ASIN' = '". $ asin. "'OR t. 'item _ code' = '". $ asin. "'";

I want this condition. The problem is that the execution result is item_code, and the asin and sku fields cannot be found when the condition is met.

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.