I've MySQL Query like this
INSERT INTO users (firstname, amount) VALUES ('Suresh', ABS('-400'));
It inserts data like this
Suresh | 400
Same Query with CakePHP Model
$this->User->query("INSERT INTO users (firstname, amount) VALUES ('Suresh', ABS('-400'))");
It inserts data like this
Suresh | 400
Now My Question is How Can I use MySQL functions with CakePHP save() function
if ($this->request->is('post')) {
$this->User->create();
$this->request->data['User']['firstname'] = "Suresh"; //This is inserting in database
$this->request->data['User']['amount'] = "ABS('-400')"; //This is not inserting in database
$this->User->save($this->request->data);
}
Please let me know where I'm doing wrong?
ABS(-400)I can use PHP function, but I want to use MySQL functions @sagiABS()can be easily solved at PHP level, there is absolutely no need to handle this at SQL level.