Re: find all not working.

2011-02-15 Thread AD7six
On Feb 14, 9:55 pm, cake-learner wrote: > Very often i got this error and i had to do custom query why it's not > putting '*'? > > $this -> loadModel( 'Company.Role' ); > $this -> Role -> useDbConfig = $this -> db_name; > $arrRoles = $this -> Role -> find( "all" ); > > Warning (512): SQL Error:

Re: find all not working.

2011-02-15 Thread AD7six
On Feb 15, 4:28 am, websurfshop wrote: > I have found the most common mistake I make when I get SQL syntax > errors like this, is that I have not properly escaped my "conditions" > statement in my find. > > Something like so works. > > $conditions = "Kjv.bnum=$bnum AND Kjv.cnum=$cnum"; >        

Re: find all not working.

2011-02-14 Thread Jeremy Burns | Class Outfit
Are the two models joined with an association (hasMany, belongsTo etc) - even if not directly? If so, all you need to do is: $variable = $this->Company->Role->find('all'); None of that model loading or db setting stuff - totally unneeded. If the models aren't joined, join them if you can; it'l

Re: find all not working.

2011-02-14 Thread websurfshop
I have found the most common mistake I make when I get SQL syntax errors like this, is that I have not properly escaped my "conditions" statement in my find. Something like so works. $conditions = "Kjv.bnum=$bnum AND Kjv.cnum=$cnum"; $verses = $this->find('list',

Re: find all not working.

2011-02-14 Thread Shinya Koizumi
On Mon, Feb 14, 2011 at 12:58 PM, Jeremy Burns | Class Outfit < jeremybu...@classoutfit.com> wrote: > That all looks a little unusual. Can you explain in non-code terms what you > are trying to do? > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.com > http://www.classoutfit.com > > On

Re: find all not working.

2011-02-14 Thread Jeremy Burns | Class Outfit
That all looks a little unusual. Can you explain in non-code terms what you are trying to do? Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 14 Feb 2011, at 20:55, cake-learner wrote: > Very often i got this error and i had to do custom query why it's not >

find all not working.

2011-02-14 Thread cake-learner
Very often i got this error and i had to do custom query why it's not putting '*'? $this -> loadModel( 'Company.Role' ); $this -> Role -> useDbConfig = $this -> db_name; $arrRoles = $this -> Role -> find( "all" ); Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the man