inv_pere.php - L-33 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND done=1) AND IFNULL((SELECT is_wh FROM dic_user WHERE id=),0)=1' at line 4 SQL:SELECT id, 0 as is_ord, 0 as check_num, contra_id, IF(IFNULL(wh_to_confirm,0)=0, 0, 1) as status_id, (SELECT id FROM dic_contra WHERE wh_id=t1.wh_id) as contra_wh_id, android_id, IFNULL(notes,'') as notes, 0.0 as itog_summ, 0.0 as discount_summ, 0 as price_index, 0 as for_in_use, '' as user_name, '?' as time1, 0 as draft, 0 as by_contra_id FROM doc_inv t1 WHERE curdate=CURDATE() AND type_id=5 AND wh_to_id IN (SELECT wh_id FROM dic_user_wh WHERE user_id= AND done=1) AND IFNULL((SELECT is_wh FROM dic_user WHERE id=),0)=1