Friends,
I have a PHP script that populates a calendar based on an array as follows:
$days = array(2=>array('javascript:showWhatsOnText(2);','linked-day'),
3=>array('javascript:showWhatsOnText(3);','linked-day'),
4=>array('javascript:showWhatsOnText(4);','linked-day'));
echo generate_calendar(2011, 4, $days, 1, '#');
where, for instance, the 2, 3 4 are the days of the month,
By extracting a series values from a MySQL database how would I generate this array dynamically.
E.g I have startday, startmonth, name and text fields in the database and would need to loop through them all to create the array.
I tried playing around with something like this without any luck:
$queryCat1 = "SELECT * FROM $dbCalendarEvents ORDER BY id ASC"; // WHERE visible = '1'
$result1 = mysql_query($queryCat1) or die (mysql_error());
$num1 = mysql_num_rows($result1);
$i=0;
$daysArray = array();
while ($i < $num1) {
$startday=mysql_result($result1,$i,"startday");
$startmonth=mysql_result($result1,$i,"startmonth");
$name=mysql_result($result1,$i,"name");
$name=mysql_result($result1,$i,"name");
$copy=mysql_result($result1,$i,"copy");
$daysArray[$i] = $startday=>array('/weblog/archive/2004/Jan/02','linked-day');
$i++;
}
Your help is appreciated.