Ummm...NEITHER is your "Top jokes by vote" working, if the code you are showing there is all you have.
Your SQL query *ALWAYS* does
ORDER BY emailed_value desc, rating_value DESC
so the emailed_value
is the first seen and will override the rating_value
I think you will have to show your HTML page where the user requests one of those 3 selections. You are clearly not interacting between the PHP code and the HTML request from the user.
If you can show a live URL, that woudl be easiest.