Jump to content

Need help with Multidimensional arrays


rjpasc

Recommended Posts

I'm having some problems getting my mind around creating a multidimensional array from a database. Maybe I'm not even really tackling the problem in the best way so any advice that can be given is greatly appreciated.

 

What I'm attempting to do is create a table on a page of server information populated from my database. The server data contains, among other things, the state the server is located in. I want to pull that data, have the table show the states, then using a jQuery app, show all the servers and their information that are associated with that state. I figured a multidimensional array would be the answer but I just can't seem to create my array.

 

I'm guessing I'll have to use a few while loops to determine what state is being pulled then the server and finally the server information. I figure the array would look something like this:

 

servers(

    state1(

        server1(info1,info2,info3)

        server2(info1,info2,info3)

    )

    state2(

        server1(info1,info2,info3)

        server2(info1,info2,info3)

    )

)

Any thoughts or suggestions on how I can do this or an easier way I might accomplish it?

Link to comment
https://forums.phpfreaks.com/topic/207332-need-help-with-multidimensional-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.