Wednesday, June 30, 2010

Re: Cannot get set variable as field from array resulting from find('first')

What do you see if you die(debug(retrieveemail)); just after you do your find?

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 30 Jun 2010, at 12:21, Rick Dane wrote:

> I am very lost at this point as I am just going in circles with trying
> to retrieve data from a database the "cakephp" way, I have looked at
> every tutorial I could find and I have basically done exactly what
> they say, as far as I can tell but I am still getting this error when
> I try to set a variable to a specific field, the error is
>
> #######error#########
>
> Notice (8): Undefined variable: retrieveemail [APP\controllers\hushmail
> \retrieveemails_controller.php, line 173]
> Code
> Notice (8): Undefined variable: retrieveemail [APP\controllers\hushmail
> \retrieveemails_controller.php, line 174]
>
> #############
>
> I am using the code below, which I am able to output using print_r to
> get the following array:
>
> "Array ( [Retrieveemail] => Array ( [emailid] =>
> testtester1010@tesst.com [password] => password) )"
>
> So I clearly have the data, it has been retrieved from the database,
> but in the code below there is something that is keeping this from
> being able to set the variable properly and it is beyond me to figure
> out what I am doing wrong, I would greatly appreciate any help..
> Thanks
>
> ########my code########
>
>
> <?php
>
> $this->set('retrieveemail', $this->Retrieveemail->find('first'));
>
>
> $email_address = $retrieveemail['Retrieveemail']['emailid'] ;
> $email_password = $retrieveemail['Retrieveemail']['password'] ;
>
> ?>
>
> ############
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: