Removed mysqli_real_escape_string and changed sorting order for various selects