Solved! Probably punbb bug.

When sending the value 0 (which is fine for that task) punbb generate valid
query.

I've defined `research` to be tinyint(1) in the `urls` table.
Mysql let `research` range to be: -128 to 127 (1 byte signed integer).
I assume that CakePHP looked on `research` as 1 bit integer (boolean), so it
let me gave it only the values 1 or 0.

Thanks
Daniel C

2009/3/23 333...@gmail.com <333...@gmail.com>

> Hi all,
>
> In the UrlsController I have the action stopTracking() (see bellow)
> that gets list of indexes of urls which I want to set `research` = -1
> for:
>
> But the $this->Url->save(); generate update query with `research` not
> changed.
>
> For instance:
> INPUT: $this->data['Url']['tracking'] = arrray(0 => 4862);
> OUTPUT QUERY: (research value remains unchanged, equal to it's value
> on the database.)
> UPDATE `urls` SET `id` = 4862, `research` = 1 WHERE `urls`.`id` = 4862
> EXPECTED QUERY:
> UPDATE `urls` SET `id` = 4862, `research` = -1 WHERE `urls`.`id` =
> 4862
>
> Controller's Action:
>    function stopTracking()
>    {
>        foreach($this->data['Url']['tracking'] as $stopTrackingId)
>        {
>            $this->Url->id = $stopTrackingId;
>            $this->Url->read(null, $stopTrackingId);
>            $this->Url->set('research', -1);
>            $this->Url->save();
>        }
>
>        $this->redirect('urls/index', null, true);
>    }
>
> Thanks a lot :)

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to