SELECT p.product_id,p.name,p.urlName,p.description,p.brutto,p.przecena,p.sex,p.r1,p.r2,p.r3,p.r4,p.r5,p.r6,p.r7,p.r8,p.r9,p.r10,p.r11,p.r12,p.r13,p.r14,p.r15,p.r16,p.r17,p.r18,p.r19,p.r20,p.r21,p.r22,p.r23,p.r24,p.r25,p.r26,p.r27,p.r28,p.r29,p.r30,p.r31,p.r32,p.r33,p.r34,p.r35,p.r36,p.r37,p.r38,p.r39,p.r40,p.r41,p.r42,p.r43,p.r44,p.r45,p.r46,p.r47,p.r48,p.r49,p.r50,p.r51,p.r52,p.quantity,pr.name as producent_name,pf.fileName,pf.description as file_description,pf.url FROM (sklep_new_products p, sklep_new_producents pr, sklep_new_products_to_category ptc, sklep_new_menu m) LEFT JOIN sklep_new_productsFile pf ON (p.product_id=pf.product_id AND file_type='pikto') WHERE p.producent_id=pr.producent_id AND p.status=1 and p.product_id=ptc.product_id AND m.menu_id=ptc.category_id AND( p.sex=all OR p.sex=0) AND p.quantity > 0 ORDER BY p.insertDate DESC LIMIT 0,12
1064: 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 'OR p.sex=0) AND p.quantity > 0 ORDER BY p.insertDate DESC LIMIT 0,12' at line 9