Your Location is: Home > Cakephp

cakephp 2.4: Add quantity with old quantity field

From: Valletta View: 2936 cms 


In my database table I have a quantity field.I am trying to add new quantities which will add with previous.

I have tried by this code in controller


Here this code working fine.But in 100 here I want to place my old data.So at first here I have to sent data which already in database.How can I send this data for add with new data ?

I have sent old data by using find methods, here is the code.

$options = array('conditions' => array('StoreProduct.' . $this->StoreProduct->primaryKey => $id));
        $request= $this->StoreProduct->find('all', $options);

I have succeed to see the quantity in edit.ctp. Now I can I send this edit.ctp to edit method in controller ?

Best answer

First, get the data using

$data = $this->StoreProduct->find('first',array('conditions'=>array(''=>$id)));

then add the data