Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2010
    Posts
    208
    Thanks
    0
    Thanked 0 Times in 0 Posts

    storing data on array question

    I can't figure this. Let say I have this structure, what is good way to save initialize this in array?


  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    408
    Thanks
    18
    Thanked 26 Times in 26 Posts
    Build a multidimensional array of the tables. The first level would be the table name and array of table rows, the sub array (table rows) would be the column name to value.

    Ex:
    PHP Code:
    $data = array(
        
    'Asya' => array(
            array(
    'Article' => 'Buddhism and Hinduism''Country' => 'Philippines''Jan' => 0'Feb' => 8'Mar' => 3),
            
    //etc..
        
    ),
        
    'Malay' => array(
            array(
    'Article' => 'Alfabetong Filipino''Country' => 'Philippines''Jan' => 0'Feb' => 8'Mar' => 3),
            
    //etc..
        
    ),
    ); 
    So you're basically creating an array of your table names, table name to sub-array, and that sub-array will contain an array of rows in the table, column name to value.
    If I've helped you out, show your appreciation by clicking the "Thanks" link as well as a link below!

    AdFly
    Facebook | Twitter
    Google | YouTube

  • #3
    New Coder
    Join Date
    Jun 2005
    Location
    Blackpool. UK
    Posts
    98
    Thanks
    0
    Thanked 4 Times in 4 Posts
    A single array or separate arrays?
    Chris

    Indifference will be the downfall of mankind, but who cares?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •