title: php syntax confusion accessing database result
body: <p>I am trying to do the following:</p>
  
  <pre><code>&lt;?php foreach($sqlResult as $row): ?&gt;
      &lt;tr&gt;
          &lt;?php foreach($formdata['columns'] as $column): ?&gt;
              &lt;td&gt;&lt;?php echo $row-&gt;$column['name']; ?&gt;&lt;/td&gt;
          &lt;?php endforeach; ?&gt;
      &lt;/tr&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>This does not work.</p>
  
  <p>$row is returned by my mysql query, it has the following : $row->id, $row->author, $row->date, $row->title and these work as they echo fine.</p>
  
  <p>$columns is the following array:</p>
  
  <pre><code>'columns' =&gt; array
  (
      1 =&gt; array
  (
      'name' =&gt; 'id'
  ),
      2 =&gt; array
  (
      'name' =&gt; 'author'
  ),
      3 =&gt; array
  (
      'name' =&gt; 'date'
  ),
      4 =&gt; array
  (
      'name' =&gt; 'title'
  )
  </code></pre>
  
  <p>it also works fine as $column['name'] echoes id, author, date, title</p>
  
  <p>my question is how would it be possible for me to access the $row->method (is it a method?) by passing it a name from the array??</p>