0

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&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');

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Funny, I over looked the simple option. I thought I needed to use foreach to do this. Thank you so much.
0

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";

1 Comment

Isn't this exactly what Tim answered with?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.