title: Display Row from Another Related Table from MySQL Using fetch_object()
body: <p>Trying to echo the author column from a another table. Currently have two tables in database one is called <code>entries</code> and the other <code>comments</code>. Both have IDs but both have the same column name "author". In the SQL statement you would do <code>select * from $table1 t1, $table2 t2 where t1.blogID = t2.blogID and t1.blogID = $postID</code>. I know how to echo from just one table using <code>fetch_object()</code></p>
  
  <pre><code>if (!empty($postID)) {
  $command = "select * from $table_name where blogID = $postID";
  $result = $db-&gt;query($command);
  while ($data = $result-&gt;fetch_object()) {
    $postID = $data-&gt;blogID;
    echo "&lt;TR&gt;&lt;TD&gt;".$postID."&lt;/TD&gt;";
    echo "&lt;TD&gt;".$data-&gt;author."&lt;/TD&gt;";
    echo "&lt;TD&gt;".$data-&gt;date."&lt;/TD&gt;";
    echo "&lt;TD&gt;".$data-&gt;entry."&lt;/TD&gt;&lt;/TR&gt;\n";
  </code></pre>
  
  <p>But, then, if I want the <code>$command</code> to select on both tables, how would I echo let say <code>t1.author</code>? Meaning do I do <code>$data-&gt;t1.author</code>? Does that make sense? Or what do you guys suggest using the format I've set-up above?</p>