0

I am in the process of building a website which promotes NGOs in out country . I am trying to build database and now i have struck at one point,

I have hundreds of NGOs in every states and i want to show all the NGO's. This is made by querying directly from database using simple SELECT with state as condition.

but We need to promote 6 NGOS in the state per month and we need to show them in top of the list every time user enters NGO's field ( eg , child labor or women security etc ) .. We need to promote at least 10 NGOS in every state for one month in every category in top 3 position in cyclic manner .. I don't know how to achieve this ... here is the simple table

I want to achieve the result as shown below

lets say 6 ngos are n1 n2 n3 n4 n5 n6

                       n1 - is high priority 
                       n2 ,n3 - second priority
                       n4 ,n5,n6  - third priority    

I want to display in my result page as below for the top 3 positions

  1 time    n1  n2  n4
  2 time    n1  n3  n5
  3 time    n1  n2  n6
  4 time    n1  n3  n4
  5 time    n1  n2  n5
  6 time    n1  n3  n6

to give equal display to all the six ngos on priority I need at least 6 times by giving n1 to allow all the time to dis[lay in 1st place, n2 & n3 to display alternatively 3 times each and finaly n44 n5 n6 will couple of display in full cylcle of 6 .

I want to keep this track and want to extract all the NGO's along with this 6 NGos in that category in that state and displaying this 6 in the above said manner rest in the aliphatic order .. how to achieve this , is there any algorithm for this kind of cyclic display

Edit : Till now , my Table has only NGO location and contact details

Table : id, ngo_name,address,state_id,category_id

SELECT * From NGO where state_id=$state & category_id = $cat_id

result is ordered by ID ...

panindra
  • 646
  • 2
  • 11
  • 33
  • Can you show the query that you are using to return any results? – Gordon Linoff Jan 11 '14 at 17:54
  • @GordonLinoff still not implemented any method just now simple select to grab the list , now i want make priority to display , can I store priority detail in different table ?? or is there any standard method / algorithm to follow something like ROUND ROBIN method – panindra Jan 11 '14 at 18:02

0 Answers0