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=9816 OR enabled=1 AND categoryID=6669 OR enabled=1 AND categoryID=9553 OR enabled=1 AND categoryID=8045 OR enabled=1 AND categoryID=9554 OR enabled=1 AND categoryID=9557 OR enabled=1 AND categoryID=9342 OR enabled=1 AND categoryID=6686 OR enabled=1 AND categoryID=7496 OR enabled=1 AND categoryID=6688 OR enabled=1 AND categoryID=9655 OR enabled=1 AND categoryID=6690 OR enabled=1 AND categoryID=7499 OR enabled=1 AND categoryID=6668 order by in_stock DESC, Price, name