Monday, February 22, 2010

Re: Not getting one of MySQL errors

Save query won't be executed at all if data do not pass validation.
Check $this->validationErrors

On Feb 23, 4:03 am, dtirer <dti...@gmail.com> wrote:
> actually, disregard that.  It's really just not executing the query,
> and is returning false.  Not sure why...
>
> On Feb 22, 1:46 pm, dtirer <dti...@gmail.com> wrote:
>
>
>
> > Actually the stranger part of this might be this.  In the dumped
> > queries, there is a select statement as follows:
>
> > SELECT `User`.`id`, `User`.`first_name`, `User`.`last_name`,
> > `User`.`email`, `User`.`password`, `User`.`phone`, `User`.`address`,
> > `User`.`city`, `User`.`zip`, `User`.`region`, `User`.`verified`,
> > `User`.`residence_id`, `User`.`rating`, `User`.`interests`,
> > `User`.`receive_email`, `User`.`guarantee_required`,
> > `User`.`contact_preference`, `Residence`.`id`, `Residence`.`residence`
> > FROM `users` AS `User` LEFT JOIN `residences` AS `Residence` ON
> > (`User`.`residence_id` = `Residence`.`id`) WHERE `User`.`email` =
> > 'djjdk...@jdjd.com' AND `User`.`password` =
> > '5cf64b046a0d906df573da6d70c60d71e82b4cad' LIMIT 1              0       0       1
> > 4
>
> > There shouldn't be any statements with the Email AND Password on this
> > page, besides the insert im trying to do.  However, it seems to be
> > executing a Select, instead of the Insert.  Any idea why that would
> > be?
>
> > On Feb 22, 1:33 pm, dtirer <dti...@gmail.com> wrote:
>
> > > My debug value is set to 2, and it's displaying all the queries,
> > > except the one I need.
>
> > > I have an Items Controller method that is calling this User Model
> > > (Item belongsTo User):
>
> > > function add_basic($email, $password)
> > >                 {
> > >                         $this->create();
>
> > >                         $this->set(array(
> > >                                                 'email' => $email,
> > >                                                 'password' => $password));
>
> > >                         if ($this->save())
> > >                                 return $this->id;
> > >                         else
> > >                                 return false;
> > >                 }
>
> > > I have confirmed that $email and $password are being passed into the
> > > function correctly (are populated with legit data).  'email' and
> > > 'password' are the names of the fields in the User model.
>
> > > I have also confirmed that on $this->save() it is returning false, but
> > > when I view the page where this occurs, the query is not being printed
> > > in the debug, and there is no error being thrown, so I have no idea
> > > whats going wrong.
>
> > > Any ideas on how I can see the error?

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: