select sql_calc_found_rows card.* from card, ranking, sort where card.crid = ranking.crid and card.crid = sort.crid and card.disp = 1 order by desc ranking.total limit 20,20

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'desc ranking.total limit 20,20' at line 1