Welcome Guest, Not a member yet? Register   Sign In
A query based off each former query result
#2

[eluser]kgill[/eluser]
Ok first things first, that query should really be in the model not the controller - the function of the controller is to decide what to do with the data coming from/going to models and views. Instead of returning the result set back to the controller to dump to the view, return an object or an array. Once you do that you'll have more control over how things work.

In the model you can then handle the images multiple ways, you can do the double query that you're doing now with the foreach and format the results into a multidimensional array (an array of arrays) or you combine the two queries into one (join the images table on the gallery id) and then return one big array or combine the queries and instead of just returning the resulting array loop through the results to produce your multidimensional array or any number of other ways depending on how creative you're feeling.


Messages In This Thread
A query based off each former query result - by El Forum - 01-29-2009, 09:45 PM
A query based off each former query result - by El Forum - 01-29-2009, 11:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB