MySQL Forums
Forum List  »  PHP

Comparing 2 arrays
Posted by: Rick Haden
Date: March 26, 2009 04:59AM

Hi all...

I have two tables, one with members names and addresses and another with records of their payments...annual subscriptions. I need to find out which ones paid in 2008 and not in 2009.

So I do a query using 2008 as the criteria and store it in array. I do the same and store it in another array.

My thought was that I can now do an array_diff against these two arrays and then print out a list of those not rejoined?

Am I wrong? Well, I must be, because it doesn't work. For a start, the number difference doesn't work out and I can't get the resultant $difference = array_diff(2008, 2009) array to print out its contents.

Am I being a complete dork here?


Rick Haden
Rick Haden Associates

Options: ReplyQuote

Written By
Comparing 2 arrays
March 26, 2009 04:59AM
March 26, 2009 01:00PM
March 26, 2009 01:20PM
March 26, 2009 05:13PM
March 27, 2009 02:21AM
March 27, 2009 01:19PM
March 27, 2009 07:06AM
March 27, 2009 08:28AM
March 27, 2009 12:58PM
March 27, 2009 10:30PM
March 28, 2009 10:25AM
March 28, 2009 09:28AM
March 28, 2009 10:28AM
March 28, 2009 03:07PM
March 30, 2009 06:01AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.