title: MySQL use inner join in PHP
body: <p>I have 2 tables, the unique id's in each table are the same in both tables.
  How do I go about joining the data from both tables together in php?</p>
  
  <p>When I normally pull data I do it like this:</p>
  
  <pre><code>    $get_board_array = mysql_query("SELECT * FROM posts WHERE user_id_to = '$id' ");
        while($posts = mysql_fetch_array($get_board_array))
          {
            $post_id = $get_post['post_id']; 
            $html_output .= "&lt;p&gt;".$post_id."&lt;/p&gt;";
          }
  </code></pre>
  
  <p>As for pulling the data from separate tables and not getting it all mixed up, I was thinking of doing something like this:</p>
  
  <pre><code>$get_arrayA = mysql_query("SELECT * FROM tableA WHERE age = '36' ");
    while($dataA = mysql_fetch_array($get_arrayA))
    {
  
        $dataA_id = $dataA['id'];
        $dataA_firstName = $dataA['FirstName'];
  
    foreach($dataA_id)
      {
        $get_arrayB = mysql_query("SELECT * FROM tableB where id='".$dataA_id."'");
        while($dataB = mysql_fetch_array($get_arrayB))
        {
  
        $dataB_lastName = $dataB['LastName'];
  
        $html_output .= "&lt;p&gt;".$dataA_firstName.$dataB_lastName"&lt;/p&gt;";
  
        echo $html_output;
        }
     }
  }
  </code></pre>
  
  <p>Or would this be just too weird of a thing?</p>
  
  <p>I know how to do it within SQL using inner join but how do I do something like that in PHP and output html?</p>