title: Get array element and use it in mysql query with php
body: <p>I want to make Mysql query like this :</p>
  
  <pre><code>$sql = mysql_query("SELECT * FROM myTable WHERE id='11' AND number='23' AND value='45' AND result='101' ");
  </code></pre>
  
  <p>I want to change the WHERE variable of mysql_query using '$myArray' array element.</p>
  
  <pre><code>$myArray[0] = array(11, 23, 45, 101);  =&gt; this is the current query
  $myArray[1] = array(21, 31, 70, 58);
  $myArray[2] = array(8, 77, 68, 94);
  </code></pre>
  
  <p>I tried to get result like this :</p>
  
  <pre><code>foreach($myArray[] as $singleRow) {
    foreach($singleRow as $myElement) { 
      $sql = mysql_query("SELECT * FROM myTable WHERE id='". $myElement ."' AND number='". $myElement ."' AND value='". $myElement . "' AND result='". $myElement ."' ");
    }
  }
  </code></pre>
  
  <p>Or like this :</p>
  
  <pre><code>for ($i=0; $i&lt;count($myArray); $i++) {
    foreach($myArray[$i] as $myElement) {
      $sql = mysql_query("SELECT * FROM myTable WHERE id='". $myElement ."' AND number='". $myElement ."' AND value='". $myElement . "' AND result='". $myElement ."' ");
    }
  }
  </code></pre>
  
  <p>Both are wrong ...  How to do the right one ? </p>
  
  <p>Thanks</p>