The values for $sort and $order should be strings, not constants, and you should check that these were actually POST'ed (using a function like [man]isset/man, for example) before you even try to use them. In fact, I wouldn't even use switch() statements at all. You could combine both switch statements as well as the two variable assignments into something like this:
$sort = ((isset($_POST['sort']) && in_array($_POST['sort'], array('name', 'type', 'tileset'))) ? $_POST['sort'] : 'name');
$order = ((isset($_POST['order']) && in_array(strtoupper($_POST['order']), array('ASC', 'DESC'))) ? strtoupper($_POST['order']) : '');
Also, I would recommend changing the "SELECT " statement to a list of column names that you use... SELECT usually wastes resources as it returns data that you don't use.