Wednesday, November 21, 2012

Two problems with data when using create and save

I have a create and save calls as shown below.  Whilst these actually create a record on the database there are two problems with the data that is saved:
1. the "fee" field value is "0.00", even though the value of $fee at run time is "0.67".  Note that the type of "fee" on the database is "decimal 10, 2".
2. the value of the "created" field is "0000-00-00 00:00:00".
 
  $sub_data = array(
   'Sub' => array(
    'user_id' => $user_id,
    'payer_id' => $payer_id,
    'payer_email' => $payer_email,
    'start_dt' => date('Y-m-d', $start_dt),
    'end_dt' => date('Y-m-d', $start_dt + $this->getDays($amount)*86400),
    'txn_id' => $txn_id,
    'amount' => $amount,
    'fee' => $fee
   )
  );
  $this->Sub->create();
  $this->logRes($amount, $fee);
  return $this->Sub->save($sub_data);
What is causing these values of the database?
 
Thanks.

--
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate