• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems with array

#11
[eluser]jedd[/eluser]
[quote author="dunken" date="1259121288"]
ok, but I want an answer like my array in the first post (but without the duplicates).

I need to send the multidim-array so that i can catch both the arrayname and the content, something like this.
[/quote]

Think in terms of the problem you're trying to solve - the end result, that is.

What you want is to be able to display the data in 2-level hierarchy. Whether you do this with a single database query and then cycle through an array with PHP, or whether you do it with many database queries and then cycle through a multi-dimensional array in PHP - that becomes a choice of which provides the better performance, the least load on the database, the most elegant approach basically.

I'll leave it to you to decide which approach is neater, but you might want to try both, and enable the Profiling class so you can evaluate which puts more load on your system.

Quote:How do I do that with your sql?

It's a trivial algorithm - check out [url="http://ellislab.com/forums/viewthread/125879/#622401"]this posting[/url] for some example code. Replace 'topic' with 'document' (etc), and 'child' with 'document_child' (etc).


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.