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

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?

[MORE INFO: Each record in the database has a unique identifier, numberid,
which would be used to identify which records are used in the combinations.
We can assume for now that the numberid is equal to the number in the
database for simplicity sake.  Sorry for not making this clear the first


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to