Saturday, October 30, 2010

Re: Empty records in database

Ok, i think i found the origin of the problem, but not the reason or
the solution.

As i said this is an online car selling site, so every time the
someone is viewing a car i was updating an database field calld 'view'
to increment the number of views for this car. To do this i was using,
in the view method of the controller :

$this->Post->saveField('view', $view+1);

I tried to remove this line and im not getting anymore those empty
posts, but as i said i still have to understand why this was
happening.


On Oct 28, 12:54 pm, AD7six <andydawso...@gmail.com> wrote:
> On Oct 25, 11:56 pm, ervin <ervin.ho...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > i've used cake for several websites and i never had such a problem.
>
> > Now one of my websites is an online car selling website when users can
> > signup and post their cars for sale.
>
> > It's about a couple of weeks that every day i find some empty posts
> > (empty DB records) in my web site. Normally this should not be
> > possible as, of course, i have an ACL control over the methods that
> > are accessible to the users. Also when a user posts something this is
> > stored in th DB along with the user id and for those posts the user id
> > is set to 0.
> > I have also tried to log the ip of the user that inserts a post
> > through the add action but for those posts the ip is empty.
> > So im quite sure that those records are not coming through the add
> > method
>
> why don't you put your tracking in the model. e.g.
>
> function beforeSave() {
>  if (!array_filter($this->data[$this->alias])) {
>   $this->log($_SERVER);
>   $this->log(Debugger::trace());
>  }
>  return true;
>
> }
>
> Most likely the symptoms you describe stem from an application error.
>
> AD

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: