Arrays inside of arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
elHelgo
Forum Newbie
Posts: 9
Joined: Tue Oct 03, 2006 3:52 pm

Arrays inside of arrays

Post by elHelgo »

I am using a calendar script, and the example places static code for the days of the month that link to certain pages:

Code: Select all

<?php
    $days = array(
        2=>array('#','linked-day'),
        3=>array('#','linked-day'),
        8=>array('#','linked-day'),
        22=>array('#','linked-day'),
    );
    echo generate_calendar(2008, 6, $days, 3, '#');
?>
I am new to nested arrays, and was wondering how I can populate the $days array when pulling from a database filled with values. In my database, I have a table for these days and have the values 'day' and 'link' stored in it. I have no problem pulling values from the database, I am just uncertain about how to populate the $days array example above, only dynamically from the MySQL database.

Any help is greatly appreciated.

Thanks,
elHelgo
Post Reply