title: display contents of PHP Mysql Array
body: <p>Simple question (I think).</p>
  
  <p>I have the below PHP / MySQL script:</p>
  
  <pre><code>$risksql="select risk from jobsrisks where job='$job'";
  $executerisks=mysql_query($risksql);
  $test=mysql_fetch_array($executerisks);
  $riskrows=mysql_num_rows($executerisks);
  </code></pre>
  
  <p>I want to print the values of the array (for testing), with code:</p>
  
  <pre><code>print_r($test);
  </code></pre>
  
  <p>This produces the below output:</p>
  
  <p><img src="https://i.stack.imgur.com/QKgdG.jpg" alt=""></p>
  
  <p>The query, in php actually outputs 3 records, not just one that is repeated. Any ideas whay I am doing incorrectly? where are the other records and why not in the array? is mysql_fetch_array the correct code to use?</p>
  
  <p>I then want to then use the PHP array in another mysql query:</p>
  
  <pre><code>$ids = join(',',$test);   
  $sql = "SELECT * FROM table WHERE risk IN ($ids)"; 
  </code></pre>
  
  <p>Would this then be correct?</p>
  
  <p>Help is appreciated as always.</p>
  
  <p>Thanks,
  R</p>