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 'INNER JOIN mst_products p ON odp.products_id = p.products_id ORDER BY ods.date' at line 18
SELECT ods.orders_id ,DATE_FORMAT(ods.date_purchased,'%Y/%m/%d') AS order_date ,DATE_FORMAT(ods.date_purchased,'%H:%i') AS order_minue ,ods.customers_state ,ods.order_total ,ods.date_purchased ,odp.products_name ,odp.products_id ,p.products_image FROM trn_orders ods INNER JOIN trn_orders_products odp ON ods.orders_id = odp.orders_id INNER JOIN mst_products_to_categories ptc ON ptc.products_id = odp.products_id AND ptc.categories_id_tab = INNER JOIN mst_products p ON odp.products_id = p.products_id ORDER BY ods.date_purchased DESC ,ods.orders_id ,odp.products_id LIMIT 50