yikes! bug with sending emails to reverse order customers
Hi I found out today after I was doing some testing which where I have a page in which the client selects customer orders from a list (checkbox select) What it does is updates their order status (Processing, Dispatched, Completed etc.) The updating of their order works through multiple checkbox selects. then its suppose to send those customers an email to tell them that their order has been updated....During testing I had 2 test orders I made with 2 different emails. when I selected my 2 orders it successfully updated the order record in the database, but I never received the email....HOWEVER I found out today that my client received an order update email and she also told me a customer had also receieved the same email..so it appears that the system was sending out an email in the reverse (in other words it must have sent the emails to ALL UNCHECKED orders in the database! But how could this be possible?
the recordset i am using for selecting all checked emails is:
<?php
if (isset($_POST["Save"])) {
mysql_select_db($database_dinkydb, $dinkydb);
$query_rsOpenOrderEmail = "SELECT * FROM orders WHERE OrderID IN (".implode(", ",$_POST["order-reference"]).")";
$rsOpenOrderEmail = mysql_query($query_rsOpenOrderEmail, $dinkydb) or die(mysql_error());
$row_rsOpenOrderEmail = mysql_fetch_assoc($rsOpenOrderEmail);
$totalRows_rsOpenOrderEmail = mysql_num_rows($rsOpenOrderEmail);
}
?>
Chris