Finding all instances
| From: | mikeyb | Date: | Sun, 30 Jun 2002 21:21:24 +0000 |
| Subject: | Finding all instances | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-104599@lists.php.net to get a copy of this message | ||
Hi,
I have a little problem I am trying to solve but right now I have no idea where to begin. I am
preying that someone out there might be able to help me.
In my MySQL database I have a group of figures, one for each record. Through PHP I have concluded
at a 'magical' number which I will need to compare against. What I need to do is try to
find all instances or combinations of figures from the database which fit inside this magical
figure, but how I do this I am not sure. I'm thinking I need to somehow read the figures into
an array somehow but I have not had enough experience with php to know how to even do this
effectively. I have read up on the issue but it all seems double dutch, and I don't know what
I need to do from this point anyway.
For example:
Magic Number: 7
Numbers in database: 12, 6, 2, 8, 5, 3, 1
Combinations returned: 1, 3, 5, 2, 6, 5&2, 3&2, 3&2&1, 5&1, 6&1, 2&1,
3&1
Can anyone please help?
Thanks,
Michael.