Forum Moderators: coopster
I have created a php function to display this and it looks like the following (pseudo code):
foreach($newsMonthArray as $month){
query2 = query the database to get all the news
while there are some news
if the news belong to that month print it
}//end while
}//end foreach
}//end function
the output looks like this
Month 1:
It is working fine at the moment, and the bit I would like to change is the red query looking for the news. Is there any way to have it outside of the foreach loop to only have one query to db instead of 1/month?
I tried having it outside (with its corresponding while) but then I don't get any data past month 1.
Hope this will make sense to someone :)