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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.