title: php mysql IN search rows
body: <p>I have the following code</p>
  
  <pre><code>$sql="select * from movieTrivia WHERE id IN ('9,2,1,4,7')";
  $array = array();
  if ($result = $mysqli-&gt;query($sql)) {
      // If the query was sucsessfull, we can get the rows
      while ($row= $result-&gt;fetch_array()) {
      $array[] = $row;
  
  }
  } else {
      // If the query failed, do something here
  }
     $a               = $row['title']; 
      $b                  = $row[1]['title'];  //out put second id in array (2)?
      $c                  = $row['title']; 
      $d                  = $row['title']; 
  echo json_encode(array("a" =&gt; $a, "b" =&gt; $b, "c" =&gt; $c, "d" =&gt; $d, "answerImg" =&gt; $answerImg));
  </code></pre>
  
  <p>Out Put is:
      $a = title1
      $b = null
      $c = title1
      $d = title1</p>
  
  <p>It only pulls the title from the first ID in the IN array (9). How do i pull the title of 2, 1, 4 and 7</p>