Jump to content

Multi Array question


ballhogjoni

Recommended Posts

Ok I am lost in this logic, can someone guide me in the right direction? I want to place all the category names in an array and then I want all the shows to be in the respective categories.

 

IE. array(['Category Name 1']=>array([0]=>show1,[1]=show2),['Category Name 1']=>array([0]=>show1,[1]=show2)

 

This is the code I have so far...

<?php
$results = $this->db->query("SELECT shows_id FROM Shows WHERE dont_show_on_main_list=0 ORDER BY name");
$showCategoriesQueryResult = $this->db->query("SELECT Shows_Categories.shows_id,Categories.category_name FROM Shows_Categories,Categories WHERE Shows_Categories.category_id = Categories.category_id");
while($results->fetchInto($row)) {
$show2 = new Show($row['shows_id']);
$temp_show = $show2->getData(); //gets the data from the Shows table based off of the id passed in

while($showCategoriesQueryResult->fetchInto($rows)) {
//I think I want to do something here but I dont know what.
}
$showInfo['category_id'][] = $temp_show;
$quickshowlinks[] = $temp_show;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/115047-multi-array-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.