Re: Save function executes before it should

2006-09-15 Thread zipman
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]

Re: Save function executes before it should

2006-09-15 Thread AD7six
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

Re: Save function executes before it should

2006-09-14 Thread zipman
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

Re: Save function executes before it should

2006-09-13 Thread zipman
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

Re: Save function executes before it should

2006-09-13 Thread AD7six
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.

Re: Save function executes before it should

2006-09-13 Thread AD7six
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.

Re: Save function executes before it should

2006-09-13 Thread [EMAIL PROTECTED]
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

Re: Save function executes before it should

2006-09-12 Thread zipman
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

Re: Save function executes before it should

2006-09-12 Thread nate
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

Save function executes before it should

2006-09-11 Thread zipman
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'));