1

As a CakePHP novice, I'm having this error:

Parse error: syntax error, unexpected T_DOUBLE_ARROW

I'm using CakePHP 2.0 and in my LogsController I have:

$conditions = array("Title.id" => $id);
$currentUser = $this->Title->find('first', array('conditions' => $conditions), 'fields'=>array('user_id'));

Any idea, how I could solve this?

1 Answer 1

4

You should place 'fields' in the array:

$currentUser = $this->Title->find('first', array('conditions' => $conditions, 'fields'=>array('user_id')));
Sign up to request clarification or add additional context in comments.

4 Comments

As I do that I get this error, "Call to a member function find().." on the same line. :?
Then Title is not a model or not loaded in the context.
Thank you.. "$this->loadModel('Title');" did the job. :)
@deShushil - You can also add Title to the $uses array in your controller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.