Re: refuses to complete all queries

From: Date: Thu, 10 Dec 2009 01:34:57 +0000
Subject: Re: refuses to complete all queries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-300354@lists.php.net to get a copy of this message
On Wed, Dec 9, 2009 at 7:18 PM, Allen McCabe <allenmccabe@gmail.com> wrote: > 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! > If you echo out the statement and run it thru phpmyadmin or some other db tool, does the statement work? -- Bastien Cat, the other other white meat

« previous php.general (#300354) next »