I have a function that looks something like this:
//iteration over scales
foreach ($surveyScales as $scale)
{
$surveyItems = $scale->findDependentRowset('SurveyItems');
//nested iteration over items in scale
foreach ($surveyItems as $item)
{
//retrieve a single value from a result table and do some stuff
//depending on certain params from $item / $scale
}
}
QUESTION: is it better to do a db query for every single value within the inner foreach or is it better to fetch all result values into an array and get the value from there?
See Question&Answers more detail:os