Do you see any problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
Only you have the power for that zipman, there doesn´t appear to be
anything inherantly wrong with your code
Disable js - do you still see 2 updates?
if so put something like log (debug_backtrace()); in your method and
see where you are calling it twice.
HTH,
AD7six
AD7six war right. What i get in the log is
06-09-14 14:32:47 Error: Package_credits: 1
06-09-14 14:32:47 Error: Old_credits: 0
06-09-14 14:32:47 Error: New_credits: 1
06-09-14 14:32:48 Error: Package_credits: 1
06-09-14 14:32:48 Error: Old_credits: 1
06-09-14 14:32:48 Error: New_credits: 2
for
The queries executed are the below
1 SELECT `CreditPackage`.`credits` FROM `credit_packages` AS
`CreditPackage` WHERE id=1 LIMIT 1 1 1 0
2 SELECT `Customer`.`credits`, `Customer`.`firm` FROM `customers` AS
`Customer` WHERE id=1 LIMIT 1 1 1
What does //some rendering calls follow do..? Do you have any
requestAction calls or redirect in there (as Nate asked).
You could use the log function instead of the echo, and if your log
states:
Package_credits: 1
Old_credits: 0
New_credits: 1
Package_credits: 1
Old_credits: 1
New_credits: 2.
PPS.
You don´t need to refer to the current credits to increment the value.
$new_credits = credits + $credits; // a string
Would do the same thing, and in this way if you find you get double
increments you can be 100% certain that the reason is because the sql
is being executed twice.
Copy your whole controller into CakeBin http://cakephp.org/pastes
And then paste the link to it in here to examine it more. And it could
be possible that another call is indeed running it, but you only see
the SQL of the current displayed controller and not other ones that
might have been
Anyone?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more
It actually looks like that code is getting executed twice. Have you
turned DEBUG up to 2, to see what queries are being executed? Are
there any redirects or requestAction calls elsewhere in your code that
would cause it to do that?
--~--~-~--~~~---~--~~
You
I have CustomersController and i have in it
var $uses = array('Customer','CreditPackage');
so that it uses CreditPackage Model too.
I have the following function
function giveCredits($customer_id,$credit_package_id)
{
$credits=$this-CreditPackage-find(id=.$credit_package_id,array('credits'));
10 matches
Mail list logo