title: mysqli select from two tables with one of them have multiple records
body: <pre><code>&lt;?php
  select1($conn); 
  function select2 ($conn,$id ,$name)
  {   
  $stmt = $conn-&gt;prepare("SELECT def FROM define WHERE wordkey = ?");
     mysqli_stmt_bind_param($stmt, 'i', $id);
     $stmt-&gt;execute(); 
     $stmt-&gt;bind_result($def);
       while($stmt-&gt;fetch()) {
       echo "here"; // for testing
       $wordArray += $def; 
       //I will make a call to the js function here sending id, name and wordArray
      }  
  //$stmt-&gt;close();
  }
  function select1 ($conn){
  $stmt2 = $conn-&gt;prepare("SELECT id , name FROM words");
     $stmt2-&gt;execute(); 
     $stmt2-&gt;bind_result($id, $name);
      while($stmt2-&gt;fetch()) {
       select2 ($conn,$id ,$name);
  }
   }
  ?&gt;
  </code></pre>
  
  <p>I want to ask question I have words table and def table. in def table i have multiple definitions for the same words.id. Is it possible to select them in one query statement ? 
  words table have id , name 
  def table have id, wordkey , definition  </p>
  
  <p>I want to retrieve name and for each name select all its definitions so that I will then call a javascript function (id, name, defArray)
  to display each name with the array of its definitions.
  I thought of doing it through 2 select statement, but the problem is the select2 function is not working.</p>