0

I have an array which contains some data, I'm getting that array using explode a string the problem is it's get shuffled on every page refresh, how can I turn off that automatic shuffle

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

now if I refresh the page the array elements get shuffled

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

my mysql fetching code

    "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";

I didnt use any code for shuffling but this comes automatically, how to turn it off?

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

     $lists = array();                            
     $lists = explode(",",$value['categories']);
 }
Ranjith M
  • 519
  • 3
  • 6
  • 24

0 Answers0