select a.clinic_name,a.address,b.city_name,c.county_name,a.phone_no,a.email_address from tbl_dentists a inner join tbl_city b on a.city=b.id inner join tbl_county c on c.id=b.county_id where a.id= order by a.id desc--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 a.id desc' at line 1