refuses to complete all queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a "PURGE ORDERS" link that calculates which orders are made up
entirely of expired shows and deletes them. Well, that's idea anyhow.

The procedure does 3 things:

1. Gets the order_id of all orders that contain all expired shows
2. Deallocates the quantity of the seats on each show from the show table
(freeing up 'inventory')
3. Deletes the order from the order table and all associated entries on the
line_item table.

Well, it does the first step beautifully, but does not want to delete the
table entries. The problem seems to be somewhere in:


// CREATE STRING FROM $black_list[] array
  $expired_order_ids_str = implode($black_list, ', ');

  // UPDATE SHOW QUANTITIES - SUBTRACT SEATS
  $getshowsSQL = "SELECT * FROM afy_order_lineitem WHERE order_id IN
({$expired_order_ids_str})";
  $showsResult = mysql_query($getshowsSQL);
  while ($updateShow = mysql_fetch_array($showsResult))
  {
   $updatequantitySQL = "UPDATE afy_show SET show_seats_reqd =
(show_seats_reqd - {$updateShow['quantity']}) WHERE show_id =
{$updateShow['show_id']}";
   $updatequantityResult = mysql_query($updatequantitySQL);
  }
  mysql_free_result($showsResult);

  // UPDATE MYSQL
  $deleteSQL = "DELETE FROM afy_order WHERE order_id IN
({$expired_order_ids_str})";
  mysql_query($deleteSQL);
  $deleteSQL = "DELETE FROM afy_order_lineitem WHERE order_id IN
({$expired_order_ids_str})";
  $deleteResult = mysql_query($deleteSQL);
  if ($deleteResult)
  {
   $message = "<font color=\"#009900\">Orders successfully Purged!<br
/>(Order #'s deleted: {$expired_order_ids_str})</font>";
  }
  break;

The works just fine, up until the // UPDATE MYSQL line. I am NOT getting the
$message set, and the orders are NOT being deleted. Only the afy_show gets
updated. Can anyone see an problem with this??

Thanks!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux