select bid_history.id ,product_master.ProductName , product_master.ProductCode , bid_history.BidAmt , bid_history.BidTime, bid_history.Status from bid_history, product_master where bid_history.ProductId =product_master.id and bid_history.UserId = order by bid_history.BidTime desc limit 0, 20 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 'order by bid_history.BidTime desc limit 0, 20' at line 1