MySQL server has gone away SQL query : select categoryID, name, brief_description, customers_rating, Price, in_stock, customer_votes, list_price, pt.productID, default_picture, sort_order, items_sold, enabled, product_code, description, shipping_freight, po.option_value from SS_products AS pt LEFT JOIN SS_product_options_values AS po ON pt.productID=po.productID and po.optionID=36 where enabled=1 AND categoryID=9343 OR enabled=1 AND categoryID=9560 OR enabled=1 AND categoryID=8936 OR enabled=1 AND categoryID=9636 OR enabled=1 AND categoryID=9561 OR enabled=1 AND categoryID=9562 OR enabled=1 AND categoryID=9558 OR enabled=1 AND categoryID=8937 OR enabled=1 AND categoryID=8938 OR enabled=1 AND categoryID=9620 OR enabled=1 AND categoryID=8939 OR enabled=1 AND categoryID=8940 OR enabled=1 AND categoryID=8941 OR enabled=1 AND categoryID=8942 OR enabled=1 AND categoryID=8943 OR enabled=1 AND categoryID=8944 OR enabled=1 AND categoryID=9618 OR enabled=1 AND categoryID=8945 OR enabled=1 AND categoryID=8946 OR enabled=1 AND categoryID=8947 OR enabled=1 AND categoryID=8935 order by in_stock DESC, Price, name