Re: Strange result with findCount
Ha, I found the problem, "State" was a 'belongsTo' Relation. So I was not able to count them.. $this->RatEwp->unbindModel(array('belongsTo'=>array('Status'))); solved the problem! Thanks! On 9 Mrz., 13:26, "phirschybar" <[EMAIL PROTECTED]> wrote: > I don't have a definite answer but I 'think' status is a reserved word > in MySQL. I only say this because when I type it into the query box in > my MySQL client, it gets highlighted as if it is reserved. Wanna try > changing it to see? > > On Mar 9, 6:42 am, "szeta" <[EMAIL PROTECTED]> wrote: > > > Hm, > > > findCount('Install_Count',0) works fine > > findCount('Status',0) does not work (returns 0) > > > Both Fields are in the same table and both are the same data-type > > (VARCHAR 255) > > > Is this a bug in CakePHP? Is 'Status' a keyword? How can I use this as > > normal Table Field for findCount? > > I have searched the whole CakePHP Code for "Status", but I did not > > find anything suspicious. > > > I'd be glad for any hint! > > > On 8 Mrz., 18:00, "phirschybar" <[EMAIL PROTECTED]> wrote: > > > > try: > > > > $this->set('test', $this->Rat->findCount('Install_Count = "7"',0)); > > > > quotes around the 7. does it work? might be because it is a varchar > > > > On Mar 8, 10:48 am, "szeta" <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > if I'm using > > > > > $this->set('test', $this->Rat->findCount('Install_Count = 7',0)); > > > > > I get a result, but if I do it on > > > > > $this->set('test', $this->Rat->findCount('Status = 7',0)); > > > > > (the only difference is the given Condition Field) > > > > > I always get "0" in return, even if i know that there are several "7". > > > > A direct Select Statement with "WHERE Status = 7" works fine. > > > > > Both fields ("Status" and "Install_Count") are a VARCHAR(255) > > > > > Any suggestion how I may count my "Status"? > > > > > Regards > > > > Ralph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange result with findCount
I don't have a definite answer but I 'think' status is a reserved word in MySQL. I only say this because when I type it into the query box in my MySQL client, it gets highlighted as if it is reserved. Wanna try changing it to see? On Mar 9, 6:42 am, "szeta" <[EMAIL PROTECTED]> wrote: > Hm, > > findCount('Install_Count',0) works fine > findCount('Status',0) does not work (returns 0) > > Both Fields are in the same table and both are the same data-type > (VARCHAR 255) > > Is this a bug in CakePHP? Is 'Status' a keyword? How can I use this as > normal Table Field for findCount? > I have searched the whole CakePHP Code for "Status", but I did not > find anything suspicious. > > I'd be glad for any hint! > > On 8 Mrz., 18:00, "phirschybar" <[EMAIL PROTECTED]> wrote: > > > try: > > > $this->set('test', $this->Rat->findCount('Install_Count = "7"',0)); > > > quotes around the 7. does it work? might be because it is a varchar > > > On Mar 8, 10:48 am, "szeta" <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > if I'm using > > > > $this->set('test', $this->Rat->findCount('Install_Count = 7',0)); > > > > I get a result, but if I do it on > > > > $this->set('test', $this->Rat->findCount('Status = 7',0)); > > > > (the only difference is the given Condition Field) > > > > I always get "0" in return, even if i know that there are several "7". > > > A direct Select Statement with "WHERE Status = 7" works fine. > > > > Both fields ("Status" and "Install_Count") are a VARCHAR(255) > > > > Any suggestion how I may count my "Status"? > > > > Regards > > > Ralph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange result with findCount
Hm, findCount('Install_Count',0) works fine findCount('Status',0) does not work (returns 0) Both Fields are in the same table and both are the same data-type (VARCHAR 255) Is this a bug in CakePHP? Is 'Status' a keyword? How can I use this as normal Table Field for findCount? I have searched the whole CakePHP Code for "Status", but I did not find anything suspicious. I'd be glad for any hint! On 8 Mrz., 18:00, "phirschybar" <[EMAIL PROTECTED]> wrote: > try: > > $this->set('test', $this->Rat->findCount('Install_Count = "7"',0)); > > quotes around the 7. does it work? might be because it is a varchar > > On Mar 8, 10:48 am, "szeta" <[EMAIL PROTECTED]> wrote: > > > Hello, > > > if I'm using > > > $this->set('test', $this->Rat->findCount('Install_Count = 7',0)); > > > I get a result, but if I do it on > > > $this->set('test', $this->Rat->findCount('Status = 7',0)); > > > (the only difference is the given Condition Field) > > > I always get "0" in return, even if i know that there are several "7". > > A direct Select Statement with "WHERE Status = 7" works fine. > > > Both fields ("Status" and "Install_Count") are a VARCHAR(255) > > > Any suggestion how I may count my "Status"? > > > Regards > > Ralph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange result with findCount
Both are VARCHAR: Field Install_Count -> works Field Status -> does not work (returns instead of 47) Is "Status" a keyword in CakePHP? Regards Ralph On 8 Mrz., 18:00, "phirschybar" <[EMAIL PROTECTED]> wrote: > try: > > $this->set('test', $this->Rat->findCount('Install_Count = "7"',0)); > > quotes around the 7. does it work? might be because it is a varchar > > On Mar 8, 10:48 am, "szeta" <[EMAIL PROTECTED]> wrote: > > > Hello, > > > if I'm using > > > $this->set('test', $this->Rat->findCount('Install_Count = 7',0)); > > > I get a result, but if I do it on > > > $this->set('test', $this->Rat->findCount('Status = 7',0)); > > > (the only difference is the given Condition Field) > > > I always get "0" in return, even if i know that there are several "7". > > A direct Select Statement with "WHERE Status = 7" works fine. > > > Both fields ("Status" and "Install_Count") are a VARCHAR(255) > > > Any suggestion how I may count my "Status"? > > > Regards > > Ralph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange result with findCount
try: $this->set('test', $this->Rat->findCount('Install_Count = "7"',0)); quotes around the 7. does it work? might be because it is a varchar On Mar 8, 10:48 am, "szeta" <[EMAIL PROTECTED]> wrote: > Hello, > > if I'm using > > $this->set('test', $this->Rat->findCount('Install_Count = 7',0)); > > I get a result, but if I do it on > > $this->set('test', $this->Rat->findCount('Status = 7',0)); > > (the only difference is the given Condition Field) > > I always get "0" in return, even if i know that there are several "7". > A direct Select Statement with "WHERE Status = 7" works fine. > > Both fields ("Status" and "Install_Count") are a VARCHAR(255) > > Any suggestion how I may count my "Status"? > > Regards > Ralph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---