title: Run a query based on another query using mysql php
body: <p>The code below searches my mysql database and comes back with postcodes like IG6,RM11,RM8,RM4,RM2,RM6,RM7,RM1,RM5 and a distance using a stored procedure. (All ok)</p>
  
  <p>PROBLEM: With these results, I want to search another table in same database that may have job information with those Postcodes (probably using <code>LIKE</code>).</p>
  
  <p>What's the best way to get this working? I have tried many examples (<code>implode</code>, <code>arrays</code>, etc) 
  Is one connection to database correct? How do I query the variable as it does come back with 2 columns, postcode and Distance. Should I split in an array (how?)</p>
  
  <p>END PRODUCT: HGV Driver RM5, Cleaner RM5, Teacher RM5</p>
  
  <p>(<code>SELECT title FROM jobinfo WHERE location IN results from other query</code>);</p>
  
  <pre><code> &lt;?php
      include ("conn.php");
      $first="RM5";
  
      $result = mysql_query("select outcode, GetDistance(Lat, Lon, (SELECT Lat from postcodes where outcode = '$first' limit 1),(SELECT Lon from postcodes where outcode = '$first' limit 1)) as Distance from postcodes having Distance &lt; 3 order by Distance DESC;");
      while($row = mysql_fetch_array($result))
      {
          echo  ($row['outcode']) ;
      } 
      // This returns postcodes
  
      $resultb = mysql_query("SELECT title FROM jobinfo WHERE location IN ($results[outcode]) ");
      while($row = mysql_fetch_array($resultb))
      {
          echo  ($row['title']) ;
      }
      mysql_close($con);
  ?&gt; 
  </code></pre>
  
  <p>Please help.....any reference to join table needs full explanation as all so far don't help!</p>