title: PHP/ARRAY/HTML TABLE -- How come this repeats the same thing across the whole <td>?
body: <p>Im trying to turn an array of friends names: $friends['name'] from the Facebook Graph API into a table with 4 columns across with one persons name in each box.</p>
  
  <p>The problem:</p>
  
  <p>I have it making a table and putting peoples names in the cells of the table, however, it repeats each persons name across all 4  in a row instead of putting a unique name in each box. However the next row starts with a new name. </p>
  
  <p>I would greatly appreaciate anybody who can help point out where Ive gone wrong and help me correct it:</p>
  
  <pre><code>    &lt;? 
      $friends_url = "https://graph.facebook.com/".$user_id."/friends?access_token=".$access_token;
      $friends_json = file_get_contents($friends_url);
      $friends_data = json_decode($friends_json, true);       
      $friends_total = count($friends_data['data']);
      $cols = 4;
      for ($i = 0; $i &lt; $friends_total; $i++) 
      {
              $friends = $friends_data['data'][$i];
              echo "&lt;tr&gt;"; 
                  for ($c=0; $c&lt;$cols; $c++) 
                  {
                  $n = $i+$c;
                      if ( $n &lt; $friends_total) 
                      {
                          echo "&lt;td&gt;".$friends['name']."&lt;/td&gt;"; 
                      }
                      else
                      {
                          echo "&lt;td&gt;&lt;/td&gt;";
                      }
                  } 
              echo "&lt;/tr&gt;"; 
          $i += ($c-1); 
      } 
      ?&gt;
  </code></pre>