cakephp - Array to string conversion [CORE\Cake\Model\Datasource\DboSource.php, line 2094] -


i have review & rating page. after viewing product customer can give review , rating. controller/review.ctp code this:

 public function review($prod_id = null) {     if($this->request->is('post')) {         $this->product->updateall(array(             'product.rating' => "'".$this->request->data['product']['rating']."'",             'product.review' => "'".$this->request->data['product']['review']."'",             array('conditions'=>array(                 'prod_id' => $prod_id))         ));         $this->session->setflash("thanks feedback !!!");     } } 

but on executing above code getting:

notice (8): array string conversion    [core\cake\model\datasource\dbosource.php, line 2094]  error: sqlstate[42s22]: column not found: 1054 unknown column 'array' in 'field list'  sql query: update `cakephp`.`products` `product` set `product`.`rating` = '4', `product`.`review` = 'abcd', `product`.`id` = array 1 = 1 

i not getting problem. appreciated. in anticipation

the query hitting not correct,try this:-

$this->product->updateall(array('product.rating' => "'".$this->request->data['product']['rating']."'",'product.review' => "'".$this->request->data['product']['review']."'"),array('conditions'=>array('pr‌​oduct.id' => $prod_id))); 

note:- )of first array misplaced. must closed before condition array.

in condition array product.id not prod_id.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -