Thursday, December 19, 2013

Re: Cakephp without Save() function?

You can create your insert statement and use the method Query(), but why don't you want to use the method Save?

Em quinta-feira, 12 de dezembro de 2013 02h18min56s UTC-4, YOONG SINJIE escreveu:
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: