Jump to content

Recommended Posts

I need to create a PHP script that selects data from MySQL table with multiple priorities?

Every MySQL row is an application for several "sports discipline" with sportsman score as the key for rating.

Sports columns holds the priority for each participient wish to participiate in exact sport. There are limited places for each sports.

That means If his first priority doesn't met (eg. he is 31st in the list, but there are only 30 places available) then the next priority must be as his wish.

An example:

ID  | Name   | Tenis   | Swiming  |  Basketball | Runing     | Score|
-----------------------------------------------------------------------
1   |John    |0        |1         |2            |3           |80    |
-----------------------------------------------------------------------
1   |Bill    |1        |2         |3            |4           |65    |
-----------------------------------------------------------------------
1   |Arnold  |0        |1         |0            |2           |70    |
-----------------------------------------------------------------------

Every disciple has its maximum participients. For an example:

$max_tenis = 5;

$max_swiming = 8;

$max_basketball = 10;

$max_runing = 9;



I qould like to select all applications for each sports and checking if they are met with the limitation set.

So that if I'm selecting all basketballs I must select all other applications with priorities more than the first priority (or second, third...) if the last priority do not met limitation.

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.