Array ( [0] => HY000 [1] => 2006 [2] => MySQL server has gone away ) select count(products.ID) as COUNT from ( select products.ID, products.NAME as NAME, products.CODE as CODE, products.TOTAL_QUANTITY as TOTAL_QUANTITY, products.RESERVED as RESERVED, products.PRICE as PRICE from gxvg_products as products left join gxvg_categories as categories on categories.ID = products.CATEGORY_ID left join gxvg_product_filters as product_filters on product_filters.ID = products.ID where (categories.ID in ( "50" , "1859" , "1900" , "1032" , "2555" , "1033" , "1034" , "1035" , "1036" , "1037" , "1038" , "1039" , "1145" , "1146" , "1147" , "1040" , "1041" , "1042" , "1043" , "2560" , "2561" , "2562" , "2563" , "2564" , "2565" , "2566" , "2567" , "2568" , "2569" , "2570" , "2571" , "2572" , "1867" , "2556" , "2557" , "2558" , "2559" , "1137" , "2573" , "2574" , "2575" , "1138" , "2576" , "2577" , "2578" , "2579" , "2580" , "2581" , "2582" , "2583" , "2584" , "1139" , "2585" , "2586" , "2587" , "2588" , "2589" , "2590" , "1140" , "1142" , "1044" , "1045" , "1046" , "1047" , "1048" , "1049" , "1050" , "1158" , "1159" , "1160" , "1051" , "1052" , "1053" , "51" , "1031" , "52" , "2633" , "1136" , "1141" , "1143" , "1144" , "1148" , "2591" , "2592" , "2593" , "2594" , "2595" , "2596" , "2597" , "2598" , "2599" , "2600" , "2601" , "2602" , "2603" , "2604" , "2605" , "2606" , "2607" , "2608" , "2609" , "2610" , "2611" , "2612" , "2613" , "2614" , "2615" , "2616" , "2617" , "2618" , "2619" , "2620" , "2621" , "2622" , "2623" , "2624" , "2625" , "2626" , "2630" , "2631" , "1149" , "1150" , "1151" , "1152" , "1153" , "1154" , "1155" , "1156" , "1157" ) OR FIND_IN_SET("50", `CATEGORIES`)) and (products.NO_SHOW!= "Y" ) and (categories.ACTIVE = "Y") and (products.TOTAL_QUANTITY - products.RESERVED > 0) ) as products ;Array ( [0] => HY000 [1] => 2006 [2] => MySQL server has gone away ) select *, (products.TOTAL_QUANTITY - products.RESERVED) as CAN_BUY from ( select products.ID, products.NAME as NAME, products.CODE as CODE, products.TOTAL_QUANTITY as TOTAL_QUANTITY, products.RESERVED as RESERVED, products.PRICE as PRICE,product_filters.S_PRICE as S_PRICE_SORT, product_filters.PARAMS as PARAMS_SORT, product_filters.MARK as MARK_SORT, product_filters.STANDART as STANDART_SORT from gxvg_products as products left join gxvg_categories as categories on categories.ID = products.CATEGORY_ID left join gxvg_product_filters as product_filters on product_filters.ID = products.ID where (categories.ID in ( "50" , "1859" , "1900" , "1032" , "2555" , "1033" , "1034" , "1035" , "1036" , "1037" , "1038" , "1039" , "1145" , "1146" , "1147" , "1040" , "1041" , "1042" , "1043" , "2560" , "2561" , "2562" , "2563" , "2564" , "2565" , "2566" , "2567" , "2568" , "2569" , "2570" , "2571" , "2572" , "1867" , "2556" , "2557" , "2558" , "2559" , "1137" , "2573" , "2574" , "2575" , "1138" , "2576" , "2577" , "2578" , "2579" , "2580" , "2581" , "2582" , "2583" , "2584" , "1139" , "2585" , "2586" , "2587" , "2588" , "2589" , "2590" , "1140" , "1142" , "1044" , "1045" , "1046" , "1047" , "1048" , "1049" , "1050" , "1158" , "1159" , "1160" , "1051" , "1052" , "1053" , "51" , "1031" , "52" , "2633" , "1136" , "1141" , "1143" , "1144" , "1148" , "2591" , "2592" , "2593" , "2594" , "2595" , "2596" , "2597" , "2598" , "2599" , "2600" , "2601" , "2602" , "2603" , "2604" , "2605" , "2606" , "2607" , "2608" , "2609" , "2610" , "2611" , "2612" , "2613" , "2614" , "2615" , "2616" , "2617" , "2618" , "2619" , "2620" , "2621" , "2622" , "2623" , "2624" , "2625" , "2626" , "2630" , "2631" , "1149" , "1150" , "1151" , "1152" , "1153" , "1154" , "1155" , "1156" , "1157" ) OR FIND_IN_SET("50", `CATEGORIES`)) and (products.NO_SHOW!= "Y" ) and (categories.ACTIVE = "Y") and (products.TOTAL_QUANTITY - products.RESERVED > 0) ) as products order by PARAMS_SORT ASC , STANDART_SORT ASC , MARK_SORT ASC limit 100, 50 ;Array ( [0] => HY000 [1] => 2006 [2] => MySQL server has gone away ) select * from gxvg_categories where ID= '50' ;Array ( [0] => HY000 [1] => 2006 [2] => MySQL server has gone away ) select * from gxvg_categories where ID= '50' ;