I get SQL error when doing Model::updateAll() . The error appeared because
my data string not quoted with single quote. It seems cake is not
automatically single quoting my data.

This is the screenshoot. Please check this out :
http://img546.imageshack.us/img546/2289/localhosttaskmonusersed.png

This is my code :
$data = array(
                "User.username" =>
"'".$this->request->data["User"]["username"]."'", // I Manually single
quoting the data
                "User.group_id" => $this->request->data["User"]["group_id"],
                "User.modified" => date("Y-m-d H:i:s") // the error come
from here
            );

            $conds = array(
                "User.id" => (int) $this->request->data["User"]["id"]
            );

            if (!empty($this->request->data["User"]["password"])) {
                $data["User.password"] =
"'".AuthComponent::password($this->request->data["User"]["password"])."'";
// I Manually single quoting the data
            }

            if ($this->User->updateAll($data,$conds)) {
                $this->Session->setFlash(__('The user has been saved'));
                $this->redirect(array('action' => 'index'));

            } else {
                $this->Session->setFlash(__('The user could not be saved.
Please, try again.'));
            }

Thank you

-- 
Like Us on FaceBook 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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to