Re: cant find a field

2014-06-04 Thread jagguy
yes this work thankyou $teacherid = $this-Teacher-field('id', array('Teacher.user_id' = $currentuserid)); -- http://itfutures.edu.au?referer=email *P: (03) 9866 7737* *E: i...@itfutures.edu.au i...@itfutures.edu.au* *A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004

cant find a field

2014-06-03 Thread ajt
Hi, Is this is the correct way to find a 1 field in 1 row of data? I just want the teacherID of a row of a given userID but I never get a match $currentuserid=AuthComponent::user('id'); $teacherid=$this-Teacher-find('first',array( 'conditions' = array('Teacher.user_id' =

Re: cant find a field

2014-06-03 Thread Jeremy Burns : Class Outfit
You ask a lot of questions that are in the book... Look at Model- field() : http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-field On 3 Jun 2014, at 15:38, ajt jagguy...@gmail.com wrote: Hi, Is this is the correct way to find a 1 field in 1 row of data? I just want the

Re: cant find a field

2014-06-03 Thread jagguy
This is for a view? I know the book and have tried this already for a controller. -- http://itfutures.edu.au?referer=email *P: (03) 9866 7737* *E: i...@itfutures.edu.au i...@itfutures.edu.au* *A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004

Re: cant find a field

2014-06-03 Thread Jeremy Burns : Class Outfit
The code you pasted probably won't work. $currentuserid=AuthComponent::user('id'); // Use $this-Auth-user('id') instead. In the find you are using the user_id field as a condition but only returning the Teacher.id field - do the Teacher.id and Teacher.user_id fields contain the same value?

Re: cant find a field

2014-06-03 Thread Jeremy Burns : Class Outfit
I missed a single speech mark when I typed my example For clarity it should be: $teacherId = $this-Teacher-field('id', array('Teacher.user_id' = $currentUserId)); On 4 Jun 2014, at 06:46, Jeremy Burns : Class Outfit jeremybu...@classoutfit.com wrote: The code you pasted probably won't work.