Use the or syntax in 1.mysql, or use note points in MySQL syntax. Project encountered pit, traverse the issue of reward data query Error!!!
$sql = ' SELECT * from ' Vvt_spread_doubleegg_exchange_award ' as P WHERE p. ' Act_type ' = 4 or P. ' Act_ Type ' = 5 and p. ' user_id ' = '. $user _id ;
The or syntax in SQL is typically used for queries of multiple conditions, the equivalent of the syntax query above: Two data sets that are queried by SQL.
$sql = ' SELECT * from ' Vvt_spread_doubleegg_exchange_award ' as P WHERE p. ' Act_type ' = 4;
$sql = ' SELECT * from ' Vvt_spread_doubleegg_exchange_award ' as P WHERE p. ' Act_type ' = 5 and P. ' user_id ' = '. $user _id;
2. To query Act_type = 4 and user_id = 11123 or Equal to P. ' Act_type ' = 5 and user_id = 11123 The data set or both sides of the condition must be added ().
$sql = ' SELECT * from ' Vvt_spread_doubleegg_exchange_award ' as P WHERE (p. ' Act_type ' = 4 or P . ' Act_type ' = 5) and p. ' user_id ' = '. $user _id ;
SQL or syntax