Wednesday, December 11, 2013

Cakephp without Save() function?

May I know , got other way to store the SQL statement, except the Save() function ? I want to do some simple calculation, i want to store the result at database. Anyone having any idea about it ?

public function add() { if ($this->request->is('post')) {
        /// complete calculation             $data1 = (string) $this->request->data['Calculate']['var1'];          $data2 = (string) $this->request->data['Calculate']['var2'];            echo $data1;          echo '<br/>';          echo $data2;            $result = $data1 + $data2;            echo '<br/>';          echo $result;          SQL Statement        mysql_query("INSERT INTO calculate VALUES('$data1','$data2','$result','2')") or die(mysql_error());         // if($this->Calculate->save($this->request->data)){           //     echo'succuful add';             // }      }
}


--
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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: