title: Get data for mysql records via array?
body: <p>I am working on my web site and I am trying to implement a feature that works like this:</p>
  
  <p>Admin checks a checkbox on a record to show that payment is received. The values are stored in an array called <code>$paymentr</code> which is imploded and updates the MySQL database.</p>
  
  <p>Now here's where the tricky part (for me, anyway) comes in:</p>
  
  <p>After it does this, the code checks how many rows have been affected and then sends out ONE email to another person that should list all the information for the records based on the IDs stored in the array.</p>
  
  <p>For some reason I've been having a bear of a time trying to figure out how to do this. I had a <code>foreach</code> loop running right before the email code which ran something like this (I have simplified the query as it is much longer and complex, but I HAVE tested it in phpmyadmin) --</p>
  
  <pre><code>foreach ($paymentr as $v) {
  
  $query = "SELECT transactions.id, transactions.refid, transactions.affid FROM transactions WHERE transactions.id = '$v'";
  
  $result = mysql_query($query) or die("Query Failed: ".mysql_errno()." - ".mysql_error()."&lt;BR&gt;\n$query&lt;BR&gt;\n");
  $trans = mysql_fetch_array($result, MYSQL_ASSOC);
  
  $transactions .= '&lt;br&gt;User ID:'.$trans['id'].' -- '.$trans['refid'].' -- '.$trans['affid'].'';
  
  }
  </code></pre>
  
  <p>Then that $transactions variable would be sent out in the email code.</p>
  
  <p>But it didn't work, sadly. Does anyone have any ideas? I feel like I am just missing one crucial chunk or idea... anything would be helpful. Maybe array_map? I've never used that though. Thank you ever so much :)</p>