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=9823 OR enabled=1 AND categoryID=9138 OR enabled=1 AND categoryID=8619 OR enabled=1 AND categoryID=6465 OR enabled=1 AND categoryID=6466 OR enabled=1 AND categoryID=9960 OR enabled=1 AND categoryID=7223 OR enabled=1 AND categoryID=6467 OR enabled=1 AND categoryID=6468 OR enabled=1 AND categoryID=8757 OR enabled=1 AND categoryID=6469 OR enabled=1 AND categoryID=6470 OR enabled=1 AND categoryID=6471 OR enabled=1 AND categoryID=7370 OR enabled=1 AND categoryID=6472 OR enabled=1 AND categoryID=6473 OR enabled=1 AND categoryID=8881 OR enabled=1 AND categoryID=9517 OR enabled=1 AND categoryID=9623 OR enabled=1 AND categoryID=9740 OR enabled=1 AND categoryID=6464 OR enabled=1 AND categoryID=6463 order by in_stock DESC, Price, name