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.