Friday, May 23, 2014

Re: filter data with controller or model?

Hi,

Didnt work sorry and I dont know how to fix this. You have to be careful with the single quotes placed here because they copy across.

Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Tutorsessions.teacher_id' in 'where clause'........??????????????????????????????????  This col exists so I dont know what to do !


In my model I have this

public function findstuff($teacherId = null) {
        if (!$teacherId) {
        return array(); }

         return $this->find('all',
            array('conditions' => array('Tutorsessions.teacher_id' => $teacherId)));
    }

I my controller I have

public  function home2()
{
  
    $teacherId=1;
    $this->set('tutor',$this->Tutorsession->findstuff($teacherId));
}


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: