Jump to content

Help with a php/mysql automatic sort code


Samuz

Recommended Posts

So basically I have a database full of players 'items'. Each player has 2 items. and I need to make a circle with these players with only specific items involved. Each circle can only contain 6 players.

 

The items needed to create this circle are:

pigs

spice

sugar

cows

aluminium

marble

iron

lumber

wheat

water

random

random

 

so 10 resources are literally needed to create this circle but 12 is needed to make it a 'circle' if you get me.

 

I'd like to note that it is possible that any of these players can have a combination of any of resources listed above.

 

I've created a form that allows people to submit players resources into my mysql database. I heard it was possible that I could code some type of filter/sort code to sort out the players resources from my database automatically into a set that will match what is needed (without any repeat of resources) and having a php code to export it into html format for viewing pleasures. I really have no idea how to go about this in mysql or php. But if somebody could help me out i'd be ever so glad.

 

Also to note: this isn't school work or something. It's from a game I play and i'm just trying to make my job in it easier.

 

I was thinking of maybe a php code that will run through all the possible partners in order to create this set like run through 100s of different sets until the required set is obtained. I heard this is just about possible. Can anyone help me?

 

Looking forward to all the great help around here.

 

Thanks

 

Samuz

 

PS: Each item/resource can only appear once in each circle.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.