calendar extension

I am extending the calendar extension (blog demo) to make a calemdar for an articles table.

I change the critiera to this (m_date is a datetime field but since there are records at this month no record is returning.What is wrong?The other code at findArticlePostedThisMonth() method is the some.Also I want to create a link to the related days  and I thing it does not work also (the code is the some)

Quote

criteria=array(

                        'condition'=>'m_date > :time1 AND m_date < :time2',

                      'params'=>array(':time1' => mktime(0,0,0,$month,1,$year),

                                          ':time2' => mktime(0,0,0,$month+1,1,$year),

                                          ),

                        'order'=>'marticles.m_date DESC',

                        );

Thang you

The simplest way to check if the error is in the SQL query itself is to add logging to your application, check your application.log (in case of error file routing) and try to run the captured query from inside sql server.

Btw you mention datetime fileds (see below for quote from MySQL Documentation)

Quote

The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

but you construct the query using mktime. See the documentation of php's date() in order to pass the right argument or consider changing your datetime fields to plain integers if you want to store results from time()/mktime() and running queries like the above.

Thang you, I changes the code to

Quote

$criteria=array(

                        'condition'=>'date_format(m_date,"%Y-%m-%e")>:time1 and date_format(m_date,"%Y-%m-%e")<:time2',

                      'params'=>array(':time1' => date('Y-m-d ',mktime(0,0,0,$month,1,$year)),

                                          ':time2' =>  date('Y-m-d ',mktime(0,0,0,$month+1,1,$year)),

                                          ),

and it seems to work.

Dimis