I am trying to search from a database of subscriptions and add all of the subscriptions to an array. Then search the database for failed or expired subscriptions, and remove them from the validSubscriptions array.
My problem is that it isn't removing the expired or cancelled ones. I've included the code below, I'd imagine it's something with my unset() line, but I can't seem to pinpoint the problem.
$validSubscriptions = array();
$query2 = "SELECT * FROM accounting_paypal WHERE payer_email='$row[EMail]' AND txn_type='subscr_signup'";
$result2 = mysql_query($query2);
while($row2 = mysql_fetch_array($result2)){
$validSubscriptions[] = $row2[subscr_id];
}
$query3 = "SELECT * FROM accounting_paypal WHERE payer_email='$row[EMail]' AND txn_type='subscr_cancel' OR txn_type='subscr_eot'";
$result3 = mysql_query($query3);
while($row3 = mysql_fetch_array($result3)){
unset($validSubscriptions -> $row3[subscr_id]);
}
If I tell it to list out the validSubscriptions array, it includes all of the subscriptions, so it must not be removing the bad ones. Does anyone have any ideas?