Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Sorting array of arrays problem

$
0
0
hi guys

i need to sort an array of products that has another array of categories inside,
something like


$prod = array();
$data = array();
$cat  = array();
$n = 0;

// $qr is a returned sql query response

 while($ln = mysql_fetch_array($qr))
{
$data['id'] = $ln['product_id'];
$data['name'] = $ln['product_name'];
$data['cat'] = $ln['product_category'];

$prod[$n] = $data;
$n++;

}

return $prod;




now i have to sort this $prod array by categories without making a new sql query, how do i do that?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>