title: Using an sql query result as a search term for a new sql statement
body: <p>So I am trying to use a result from an SQL search <code>$search_course</code> and then having that as the <code>WHERE LIKE</code> part of the next statement <code>$Search_Module</code>.</p>
  
  <p>once the <code>$Search_Module</code> query has finished I would like the results to be in a list which I know should be coded correctly.</p>
  
  <p>I have tried the following code but the search returns no values;</p>
  
  <p>Any help with this would be much appreciated, thanks in advance.</p>
  
  <pre><code>        $search_course = "
      SELECT title, id, wyl, overview, module, course, careers
      FROM course
      LEFT JOIN cm
      ON course.id=cm.course
      WHERE id LIKE '%".$_POST['submitcourseselection']."%'";
  
      $result = $mysqli-&gt;query($search_course) or die($mysqli-&gt;error);
      $display_course = $result-&gt;fetch_assoc();
  
      //Searches the module table in the DB for modules within the course
      $Search_Module = "
      SELECT id, title, level, credits
      FROM module
      WHERE id LIKE '".$search_course['module']."'";
  
      $M_Results = $mysqli-&gt;query($Search_Module) or die($mysqli-&gt;error);
  
  
      $ModuleList = '';
      while ($MResults = $M_Results-&gt;fetch_assoc()) {
          $ID = $MResults['id'];
          $Title = $MResults['title'];
          $Level = $MResults['level'];
          $Credits = $MResults['credits'];
          $ModuleList.='&lt;div&gt;&lt;h2&gt;'.$Title.'&lt;/h2&gt;&lt;/div&gt;'; 
      }
  </code></pre>