0

I am using the query function in cake PHP ($this->query(select...)), and I know it returns an array of the values. If the query will only return one value, what is the position of that value in the array?

Would $element = $arrayName(0) be correct?

I'm trying to use it as such:

$flowsheet_name = $this->query("select FLOWSHEET_NAME from FLOWSHEET_TEMPLATE where FLOWSHEET_ID = ".$value.";");
        $flowsheet_question = $flowsheet_name(0);
        array_push($this->$filedMethodMappings, $flowsheet_question => array(
                CaBase::KEY_MAPPING_LOGIC_COMPLEXITY => CaBase::LEVEL3_COMPLEXITY,
                CaBase::KEY_FIELD_LOGIC_NAME         => 'wsUnifiedKey',
                CaBase::KEY_FIELD_QUESTION_ID        => ''.$value,
                )
            );

But I can't tell if it's working. I'm getting a double arrow error here:

$flowsheet_question => array(
2
  • Why not trying it by yourself? P.S It would Commented Jun 18, 2012 at 20:59
  • I actually did try it, I just couldn't tell if it was working. I updated the question to make it a little more clear :) Commented Jun 18, 2012 at 21:03

1 Answer 1

2

In CakePHP, easy way to see what is going on in your array is:

debug($flowsheet_name);
Sign up to request clarification or add additional context in comments.

Comments

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.