Sunday, September 16, 2012

Cake 2.2 Can't save/update database

The following code in my PlayersController doesn't error but also doesn't save anything to the database table...

    private function authorize($tag, $pass) {
        $findPlayer = $this->Player->find('first', array(
            'conditions' => array('Tag' => $tag, 'Password' => $pass)
        ));
        $playerID = 0;
        if ( count($findPlayer) > 0 ) {
            $playerID = $findPlayer['Player']['ID'];
            $data = array('id' => $playerID, 'CurrentLogin' => date('c'));
            $this->Player->save($data);
        }
        unset($findPlayer);
        return $playerID;
    }

In my table the "id" field is actually "ID", however if I change the $data line above to "ID", then cake switches to Insert mode and blows up. So far nothing I do will update the table. What am I doing wrong?

Thanks for your advice. I'm spinning my wheels...

Mark

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate