see the documentation or lots of google results 
like http://stackoverflow.com/questions/6988160/cakephp-updateall-issues
they all state the same: you need to manually escape for updateAll()


Am Mittwoch, 12. Dezember 2012 18:45:50 UTC+1 schrieb polutan polution at 
all:
>
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to