Awesome, that explained a lot for me, thank you. So here's my updated code:
<?php
include 'config.php';
$result = mysql_query("SELECT day,link,eventday FROM calendar");
// define an array. not required, but good programming practice:
$myarray = array();
// While there are results, you retrieve them from the database, and retain them in the associate array '$row'
if($result)
{
while($row = mysql_fetch_array($result))
{
// Now we do the magic: Either fill the array, without defining the key, which will then be 0 => number of values-1:
// $myarray[] = $row['day'];
// Or use the ID colum to define the KEY of the array:
$myarray[$row['day']] = "array('".$row['link']."','".$row['eventday']."'),<br />";
// End the for loop
}
}
// show the structure & values of the array, for debugging:
print_r($myarray);
?>
And it outputs:
Array ( [20] => array('testnow','linked-day'),
[23] => array('test3','linked-day'),
[2] => array('gdde','linked-day'),
[30] => array('asdf','linked-day'),
[19] => array('awerwsd','linked-day'),
)
So it's starting to look like:
$days = array(
2=>array('/weblog/archive/2006/Dec/02','linked-day'),
3=>array('/weblog/archive/2006/Dec/03','linked-day'),
16=>array('/weblog/archive/2006/Dec/08','linked-day'),
22=>array('/weblog/archive/2006/Dec/22','linked-day'),
$today=>array(NULL,NULL,'<span style="color:red; font-weight:bold; font-size:12px;">'.$today.'</span>'),
);
But now how can I get the first numbers like [23] => out of the brackets to make it look like the $days array? As well as add a semicolon at the end after the )?