I have written a program which to update credit in an account.

When I run once, it work fine.
When I run more than once, the problem come. It seems not to reflect
immediately the new updated value.
for example
query: credit = 200
1st loop
credit = 200 (this is from line 23)
operation: credit = credit - 1
update = 199
2nd loop
credit = 200 (it is still 200, not 199; the query line is gone, it
should be under line 35)
operation: credit = credit - 1
update = 199

20      LOCK TABLE accounts as account WRITE, accounts WRITE            0       
        1
21      SET autocommit = 1;             0               1
22      BEGIN           0               0
23      SELECT `Account`.`id`, `Account`.`username`, `Account`.`password`,
`Account`.`admin`, `Account`.`credits`, `Account`.`created`,
`Account`.`modified` FROM `accounts` AS `Account` WHERE `id` = 1 LIMIT
1               1       1       1
24      SELECT COUNT(id) AS count FROM `accounts` WHERE `id` = 1                
1       1       1
25      SELECT COUNT(id) AS count FROM `accounts` WHERE `id` = 1                
1       1       1
26      UPDATE `accounts` SET `id` = 1,`username` = 'admin',`password` =
'e1355c5a9e3b1729c2b8d2499831c3f5',`admin` = 1,`credits` =
198,`created` = '0000-00-00 00:00:00',`modified` = '2007-12-19
13:47:49' WHERE `id` IN (1)             1               2
27      COMMIT          0               14
28      SELECT credits FROM accounts WHERE id = 1;              1       1       
1
29      UNLOCK TABLES           0               0
30      SELECT COUNT(id) AS count FROM `smses` WHERE `id` = 15          1       
1       22
31      SELECT COUNT(id) AS count FROM `smses` WHERE `id` = 15          1       
1       1
32      UPDATE `smses` SET `status_id` = 1,`modified` = '2007-12-19
14:25:05' WHERE `id` IN (15)            0               1
33      INSERT INTO `sms_reports`
(`sendTo`,`mid`,`status_id`,`sendtime`,`sms_id`,`messageText`,`credit`,`created`,`modified`)
VALUES ('60166471113','2','1','2007-10-09 11:02:25',15,'test group 1',
1,'2007-12-19 14:25:05','2007-12-19 14:25:05')          1               14
34      SELECT LAST_INSERT_ID() AS insertID             1       1       1
35      LOCK TABLE accounts as account WRITE, accounts WRITE            0       
        2
36      SET autocommit = 1;             0               1
37      BEGIN           0               0
38      SELECT COUNT(id) AS count FROM `accounts` WHERE `id` = 1                
1       1       1
39      SELECT COUNT(id) AS count FROM `accounts` WHERE `id` = 1                
1       1       1
40      UPDATE `accounts` SET `id` = 1,`username` = 'admin',`password` =
'e1355c5a9e3b1729c2b8d2499831c3f5',`admin` = 1,`credits` =
198,`created` = '0000-00-00 00:00:00',`modified` = '2007-12-19
13:47:49' WHERE `id` IN (1)             0               1
41      COMMIT          0               0
42      UNLOCK TABLES

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to