title: sql query with for loop and array
body: <p>I have a for loop that i use to perform a syntax multiple times:</p>
  
  <pre><code>for ($c=1; $c&lt;=$rowCount; $c++){
      $reas[$c-1]=$_SESSION["reas".$c];
      $exp[$c-1]=$conn-&gt;query("SELECT reason_exp from rehab_reasons where reason_name='".$reas[$c-1]."'");
  
  }
  </code></pre>
  
  <p>now i want to echo it using for loop too..</p>
  
  <pre><code>for ($x=0; $x&lt;$rowCount; $x++){
  $text=$act[$x].' was given to '.$conj[$x].' '.$reas[$x].' '.$exp[$x]['reason_exp'];
  }
  </code></pre>
  
  <p>it seems not working.. wht i want to do is to have:
  $exp[0]= reason_exp from the database where reason_name= $reas[0]
  $exp[1]= reason_exp from the database where reason_name= $reas[1]
  ...
  and so on..</p>
  
  <p>what is wrong with my syntax?   </p>