Re: assignment of data into a 2 dimensional array
| From: | Mattias Thorslund | Date: | Mon, 03 May 2004 19:12:33 +0000 |
| Subject: | Re: assignment of data into a 2 dimensional array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185234@lists.php.net to get a copy of this message | ||
Adam Williams wrote:
[...] but I need to somehow put the dates and their corresponding cardnum's into an array so that I can loop through the array to count the number of discrete visits by each cardnum.For the rest of the list I should mention that you say a "visit" is the same as one or more occurrences of one card number in a particular day. That could be easier done in the SQL statement... After all, this is the power of SQL :-) Try something along the lines of SELECT date, cardnum FROM your_table WHERE [from-to conditions] GROUP BY date, cardnum or SELECT DISTINCT date, cardnum FROM your_table WHERE [from-to conditions] Note that if you needed it, you could also get the number of card swipes in the former case, by adding COUNT(cardnum) as NumSwipes to the select clause. /Mattias