Issue
I have a question i want to get all the dates after the current date.
I use this code for that but it don't work.. can someone help me.
public function index() {
$this->loadModel('wp_em_events');
$date = date('d-m-Y');
$this->set('wp_em_events',$this->wp_em_events->find('all', array(
'conditions' => array(
'wp_em_events.event_start_time >=' => date('Y-m'),
)
)));
}
Solution
Your comment pointing to site nielsvandijkje.nl/demo doesn't reply how field event_start_time
is defined in the db.
Still in your demo results are:
2014-07-04
2 Traditional music session 2013-02-17
3 6 Nations, Italy VS Ireland 2014-01-20
Query
SELECT [...] WHERE `event_start_time` >= '2014-07-04'
Since results with date 2013-02-17 and 2014-01-20 are returned it means that most probably the field isn't defined as a date
and the db tries to compare strings which will fail to produce correct results.
So this doesn't seem like a cakephp issue but a DB issue. You can confirm it by running the raw SQL in phpmyadmin or mysql's CLI which should yield the same (wrong) results.
Answered By - user221931
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.