Is there an proper way to structure the array better for looping

TTRainbow

New Member
OK so I have thispage and as you can see I am loggering the array of 12 products. If you scroll down you can see the requirements are that i need to group them by category name but i am not sure the best way to structure the loops. \[code\]my query$query = "SELECT p.name, p.price, pc.quantity, p.image, p.descr, t.name as Category_name FROM products as p join categorizations as pc on p.id = pc.product_id join categories as c on c.id = pc.category_id JOIN types AS t on t.id = p.type_id WHERE c.code = '{$type}_{$count}' order by p.order desc";$allproducts = array();while($row_r = mysql_fetch_assoc($result)){ $allproducts[] = $row_r;}\[/code\]maybe i need to change my query or something to group by category name but that might drop some products. maybe i can create a multidemensional array and loop each category nameany suggestions
 
Back
Top