Array inside an array PHP SQL
I have tried everything I can think of for the last two days. I'm truly lost. I need to get this line of code to change based on my database. I have tried everything I could find on php.net and many forums.
$Myday=>array('/index.php?day=$Myday&开发者_StackOverflow;year=$MYyear','linked-day'),
Any ideas or help would be much appericated
$SQL = "SELECT * FROM DATE_BOOK'";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$agenda_id = $row["agenda_id"];
$MYyear = $row["agenda_year"];
$Myday = $row["agenda_day"];
$agenda_month = $row["agenda_month"]; }
$days = array(
$Myday=>array('/index.php?day=$Myday&year=$MYyear','linked-day'),
$Myday=>array('/index.php?day=$Myday&year=$MYyear','linked-day'));
echo generate_calendar(2009, 1, $days, 3, '/weblog/archive/2004/Jan');
You want this out side your loop:
$days = array();
And this inside your while loop:
$days[$Myday] = array('/index.php?day=$Myday&year=$MYyear','linked-day');
Your loop isn't actually adding to your array its just assigning a bunch of variables that get rewritten anyways.
For anyone else trying to get http://keithdevens.com/software/php_calendar to work here is the simple code. When trying to figure it out I saw a lot of people who were looking for an answer.
$xgenda_real_date = date("m/d/Y");
$xgenda_month = date("m");
$xgenda_day = date("d");
$xgenda_year = date("Y");
$days = array();
$query = "SELECT * FROM DATE_BOOK";
$result = mysql_query( $query );
while( $row = mysql_fetch_array($result ) ) {
$Myday = $row["agenda_day"];
$agenda_id = $row["agenda_id"];
$agenda_year = $row["agenda_year"];
$agenda_month = $row["agenda_month"];
$days[$Myday] = array("/index.php?day=$Myday&year=$MYyear",'linked-day');
}
echo generate_calendar($xgenda_year, $xgenda_month, $days, 3,'index.php?page_id=$page_id', $pn);
echo "<p>$xgenda_real_date";
精彩评论