1

What am I doing wrong in the 'andWhere' part of this query? I've tried a variety of different ways of doing it but nothing seems to work... It just seems to be ignored. Does anyone know the proper way I should be doing it?

foreach($entryIds as $entryId) {
    $data[] = craft()->db->createCommand()
    ->select('*')
    ->from('amforms_content')       
    ->where(array(
            'elementId' => $entryId
    ))
    ->andWhere('dateCreated > 2017-02-11')
    ->queryAll();
}

return array($data);
  • 2
    Try: ->andWhere('dateCreated > "2017-02-11"') – Brad Bell Feb 17 '17 at 17:20
2

The syntax for comparing a date should be:

->andWhere('dateCreated > "2017-02-11"')
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.