I'm trying to sort a list with asc or desc - depending on what the user choose. In the list I have the Swedish characters Å Ä Ö and it's here the problem shows up. I have the following list:
(First list)
Stängd
Stängd
Öppen
Krävs ej
Krävs ej
(Standing for; Stängd = Closed, Öppen = Opened, Krävs ej = Not required)
The list should be sorted - depending on what the user choose;
Öppen
Stängd
Stängd
Krävs ej
Krävs ej
or
Krävs ej
Krävs ej
Stängd
Stängd
Öppen
But as it is now the first list is showing up. So the problem is the "Ö" -character. My database and the field that the value is in have the collation utf8_general_ci, so that is'nt the problem. And the character "Ö" is right in both database (looking throu PHPMyAdmin) and output right when printing it out.
My code look like this:
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = '$sort_by'
AND wposts.post_type = 'sida'
AND wposts.post_status = 'publish'
ORDER BY wpostmeta.meta_value $sort_order";
How can this appear and how does I solve it?