如何关闭SQL查询结果的混乱

时间:2016-08-11 05:21:10

标签: php mysql arrays shuffle

我有一个包含一些数据的数组,我使用爆炸字符串获取该数组的问题是它在每次刷新页面时都会被洗牌,我该如何关闭自动洗牌

$cat = explode(",",$categories);
Array ( [0] => item1 [1] => item2 [2] => item3 [3] => item4 );

现在如果我刷新页面,数组元素就会被洗牌

Array ( [0] => item4 [1] => item2 [2] => item3 [3] => item1 );

我的mysql抓取代码

    "SELECT *,  GROUP_CONCAT(DISTINCT c.category_name SEPARATOR ',') AS categories , 
            FROM subscription s
            LEFT JOIN subscription_category sc ON s.subscription_id=sc.subscription_id
            LEFT JOIN category c ON sc.category_id=c.category_id
            GROUP BY s.subscription_id
            ORDER BY s.subscription_id DESC";

我没有使用任何代码进行改组,但这会自动生成,如何将其关闭?

 foreach ($data as $key => $value){

     $lists = array();                            
     $lists = explode(",",$value['categories']);
 }

0 个答案:

没有答案