mysql查询连接错误

can anyone tell me what is the wrong with the query

$sql = "SELECT * FROM user_monsoon_offer WHERE DATE_ADD(start_date,INTERVAL 4 DAY) = ' ".$date." ' AND user_monsoon_offer.user_id NOT IN (SELECT user_id FROM transactions)";

I believe the extra whitespace you have in your concatenation is causing the problem. Try this:

$sql = "SELECT * FROM user_monsoon_offer 
        WHERE DATE_ADD(start_date,INTERVAL 4 DAY) = '$date' 
        AND user_monsoon_offer.user_id NOT IN (SELECT user_id FROM transactions)";

Your original WHERE clause looked like the following:

WHERE DATE_ADD(start_date,INTERVAL 4 DAY) = ' 2016-06-21 '

This won't work because of the extra spaces.

I believe your looking for Dynamic data concatenation in filter condition.Use below condition.

SELECT * FROM user_monsoon_offer
WHERE SUBDATE(start_date,4) = ' ".$date." '
  AND user_monsoon_offer.user_id NOT IN (SELECT user_id FROM transactions);