I am working on my web site and I am trying to implement a feature that works like this:
Admin checks a checkbox on a record to show that payment is received. The values are stored in an array called $paymentr which is imploded and updates the MySQL database.
Now here's where the tricky part (for me, anyway) comes in:
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.
For some reason I've been having a bear of a time trying to figure out how to do this. I had a foreach 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) --
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()."<BR>\n$query<BR>\n");
$trans = mysql_fetch_array($result, MYSQL_ASSOC);
$transactions .= '<br>User ID:'.$trans['id'].' -- '.$trans['refid'].' -- '.$trans['affid'].'';
}
Then that $transactions variable would be sent out in the email code.
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 :)
var_dump($trans)prints?