title: Passing value through series of arrays
body: <p>I've asked this question before but the answers were not significant to assisting me.</p>
  
  <pre><code>    $sql  = 'SELECT `name`, `course`, `id` FROM `teacher` ORDER BY `id` ASC';
      $rows = $mysql_conn-&gt;fetch_array($sql);
      // Teacher's Table (id / name / link /course)
      // Course default = 1-1-1-1-1-1-1-1
  
      foreach($rows as $record) { 
          $result[$record['name']] = $record['course']; 
          //$result["Moore,Tyler"] = "1-1-1-1-1-1-1-1";
          //$result["Craig,Joey"]  = "1-2-2-2-1-1-1-1";
          //$result["Degra,Tina"]  = "2-1-1-1-2-1-1-1";
      }
  
      foreach($result as $teacher=&gt;$courses){
          $result[$teacher] = explode('-',$courses); // Remove -'s from courses and separate the array into sections
          //$result["Craig,Joey"][0] = 1;
          //$result["Craig,Joey"][1] = 2;
          //$result["Craig,Joey"][2] = 2;
          //$result["Craig,Joey"][3] = 2;
          //$result["Craig,Joey"][4] = 1;
          //$result["Craig,Joey"][5] = 1; 
          //$result["Craig,Joey"][6] = 1;
          //$result["Craig,Joey"][7] = 1;
      }
  
      foreach($result as $teacher=&gt;$courses){
          foreach($courses as $period =&gt; $course){
              if($course == $id) { // If course is equal to course page (selected course) record the period 1-8
                  $name = explode(',', $teacher); // $name[0] = 'Craig' / $name[1] = 'Joey';
                  $result[$period][] = '&lt;a href="?page=teacher&amp;id="&gt;'.$name[0].'&lt;br /&gt;'.$name[1].'&lt;/a&gt;'; 
                  // I want id= to get an id passed to it from the query
              }
          }
      }
  </code></pre>
  
  <p>I want to have the teacher's ID passed through so I can feature it into the link near the bottom of the code.</p>
  
  <p>This is absolutely necessary however I can not seem to figure it all out without my head hurting.</p>
  
  <p>Any help would be much appreciated! :)</p>