i have a questing regarding associates multidimensional arrays in php.
Let's say i have the following table:
Product Nr Img
kat1 abc abc.png
kat1 xyz xyz.png
kat2 def def.png
kat2 gfh gfh.png
kat2 jug jug.png
kat3 lkj lkj.png
kat3 tfh tfh.png
kat4 fsg fsg.png
kat4 gzt gzt.png
Building an array like:
$table= array(
array("Product" => "Kat1","Nr" =>"abc","IMG" =>"abc.png"),
array("Product" => "Kat1","Nr" =>"xyz","IMG" =>"xyz.png"),
array("Product" => "Kat2","Nr" =>"def","IMG" =>"def.png"),
array("Product" => "Kat2","Nr" =>"gfh","IMG" =>"gfh.png"),
array("Product" => "Kat2","Nr" =>"jug","IMG" =>"jug.png"),
array("Product" => "Kat3","Nr" =>"lkj","IMG" =>"lkj.png"),
array("Product" => "Kat3","Nr" =>"tfh","IMG" =>"tfh.png"),
array("Product" => "Kat4","Nr" =>"fsg","IMG" =>"fsg.png"),
array("Product" => "Kat4","Nr" =>"gzt","IMG" =>"gzt.png"),
);
i want to built random productsets. and every productsets should contain one product from every single kategorie. for example the following output:
Kat1 = abc, abc.png
Kat2 = gfh, gfh.png
Kat3 = lkj, lkj.png
Kat4 = gzt, gzt.png
I'm not sure if i'm on the right way or if its possible with that kind of array. Any Ideas how i can solve that?