我有下一个代码,但使用 ORDER BY 没有得到想要的结果:
// OrderBy WHERE Conditions
if ($sort_by == "0") $sortby_condition = "ORDER BY mv_user_ranking.ranking_date DESC ";
if ($sort_by == "1") $sortby_condition = "ORDER BY mv_user_info.age DESC ";
if ($sort_by == "2") $sortby_condition = "ORDER BY mv_user_info.sex DESC ";
$query ="SELECT * FROM mv_user_info
LEFT JOIN mv_user_lang_interested ON mv_user_lang_interested.uid = mv_user_info.uid
LEFT JOIN mv_user_disponibility ON mv_user_disponibility.uid = mv_user_info.uid
LEFT JOIN mv_user_ranking ON mv_user_ranking.uid = mv_user_info.uid
WHERE country ='$country' AND city = '$city' AND
mv_user_lang_interested.english = '1' AND
mv_user_lang_interested.english_level = '2' AND
mv_user_info.uid != '$uid'"
.$sortby_condition.
"LIMIT 0, 50";
echo $query;
$result = mysql_query($query) or die(mysql_error());
我做错了什么?