MySQL日期格式排序错误

时间:2014-02-20 09:53:35

标签: php mysql date

用于排序查询的desc或asc日期失败:(

我应该如何进行mSQL查询?

请帮助你?

$tours = mysql_query("SELECT * FROM tours WHERE tour_category_id='".$tour_category_id[category_id]."' AND tour_status='Aktif' ORDER BY kayit_tarihi DESC ");

3 个答案:

答案 0 :(得分:0)

  $someVariable =  $tour_category_id[category_id];
 $tours = mysql_query("SELECT * FROM tours WHERE tour_category_id='$someVariable' AND tour_status='Aktif' ORDER BY kayit_tarihi DESC ");

试试这个。

答案 1 :(得分:0)

$tours = mysql_query("SELECT * 
                      FROM tours 
                      WHERE tour_category_id='".$tour_category_id[category_id]."' 
                        AND tour_status='Aktif' 
                      ORDER BY tour_category_id DESC ");

答案 2 :(得分:0)

$tour_category_id[category_id]更改为$tour_category_id["category_id"]