title: jQuery toggle() on array of mysql fetched arrray
body: <p>I have a fetched with php as an array and it is categorized. See code:</p>
  
  <pre><code>&lt;table&gt;&lt;?php 
      $cat_set = get_all_cats();
      while($category = mysql_fetch_array($cat_set)){
  
          if($category["category"] != "no-cat"){
              echo "&lt;tr colspam=\"2\"&gt;&lt;td&gt;&lt;/td&gt;&lt;td id=\"cats\"&gt;".$category["category"]."&lt;td&gt;&lt;img id=\"blink\" src=\"drop.png\"&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;";
              $course_set = get_courses_for_cats($category["cat_id"]);
                  while ($course = mysql_fetch_array($course_set)) {
                  echo"&lt;tr class=\"cont\"&gt;&lt;td&gt;&lt;input value = ". $course["course_code"] ." name=\"boxes[]\" type=\"checkbox\"&gt;&lt;/td&gt;&lt;td class=\"code\"&gt;" . $course["course_code"] . "&lt;/td&gt;&lt;/tr&gt;&lt;/input&gt;";
  
                  }
  
          }
          else {
              $course_set = get_courses_for_cats($category["cat_id"]);
                  while ($course = mysql_fetch_array($course_set)) {
                  echo"&lt;tr class=\"cont\"&gt;&lt;td&gt;&lt;input value = ". $course["course_code"] ." name=\"boxes[]\" type=\"checkbox\"&gt;&lt;/td&gt;&lt;td class=\"code\"&gt;" . $course["course_code"] . "&lt;/td&gt;&lt;/tr&gt;&lt;/input&gt;";
  
              }
          } 
      }
          ?&gt;
          &lt;/table&gt;
  </code></pre>
  
  <p>So every course has a categoty.
  Now what I want to do is to use jquery to hide the course unless its category is clicked an this is what i have achieved</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function(){
          $(".cont").hide();
          $("#cats").click(function(){
              $(".cont").toggle();
          });
      })
  
      &lt;/script&gt;
  </code></pre>
  
  <p>but it when i click the category it hides all the courses even those that does not belong to itself. I know if the categories had different ids it would have been better but because it is an array, one id serves them all. Please any idea on how i can fix this. Thanks</p>