Rather than do findById try find (...'conditions' => array('CodeCategory.CodeCatId' => $id)...
You might need t experiment with different iterations of the field name but I think that's what you need to do. findById will look for a field called id, just as findByTractor will search for a field called tractor. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 11 Dec 2010, at 20:56, Rishi wrote: > No I dont have a ''ID ' in the database. This is the strcture of my > table > > CREATE TABLE `cvmdl`.`code_categories` ( > `CODE_CAT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT, > `CODE_CAT` varchar(45) NOT NULL, > `CODE_DESC` varchar(225) DEFAULT NULL, > PRIMARY KEY (`CODE_CAT_ID`) USING BTREE > ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; > > > > On Dec 11, 3:52 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote: >> ofc...have u 'id' field in table in database?...if no, this is problem :D >> -- >> Tilen Majerlehttp://majerle.eu >> >> 2010/12/11 Rishi <rishikant...@gmail.com> >> >> >> >> >> >> >> >>> hi group, >> >>> I have the following model >> >>> //file model name: code_category.php >>> <?php >> >>> class CodeCategory extends AppModel { >> >>> var $name = 'CodeCategory'; >>> var $primaryKey = 'CODE_CAT_ID'; // exactly same in db >>> } >>> ?> >> >>> when I try to find a row using $this->CodeCategory->findById($id); >> >>> I have the following error . >> >>> SQL Error: 1054: Unknown column 'CodeCategory.id' in 'where clause' >> >>> Can someone please help me. >> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others >>> with their CakePHP related questions. >> >>> You received this message because you are subscribed to the Google Groups >>> "CakePHP" group. >>> To post to this group, send email to cake-php@googlegroups.com >>> To unsubscribe from this group, send email to >>> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c >>> om>For more options, visit this group at >>> http://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en