What I am saying is you can't redirect to another page in the same transaction. If you really need to do something over multiple page loads, then you should save this data in temporary tables or in the session, and then add it all to the real tables on the final page. Transactions are meant to be kept as short as possible.
Cheers, Adam ----- Original Message ----- From: "Mateo San Román" <[email protected]> To: "CakePHP" <[email protected]> Sent: Tuesday, June 23, 2009 7:02 AM Subject: Re: transactions + redirect doesn't work! Thank you for you quick answer. Any way to do that operation in a standard way? Thanks, Mateo On 22 jun, 00:45, "Adam Royle" <[email protected]> wrote: > Yes. You must start and end atransactionwith the same mysql connection. > MySQL connections are automatically closed once the page has finished > executing. Aredirectstops the current page execution. > > Cheers, > Adam > > ----- Original Message ----- > From: "Mateo San Román" <[email protected]> > To: "CakePHP" <[email protected]> > Sent: Monday, June 22, 2009 2:49 PM > Subject: transactions +redirectdoesn't work! > > > Hello > > > I have this code: > > > function A () { > > $this->query('BEGINTRANSACTIONA'); > > xxx > > xxx > > $this->redirect('/controller/B); > > } > > > function B () { > > xxx > > xxx > > $this->query('COMMITTRANSACTIONA'); > > } > > > doesn't work because there is a missing "BEGINTRANSACTION" > > > However, if I use instead > > > $this->query('BEGINTRANSACTIONA'); > > xxx > > xxx > > $this->B(); > > } > > > It works somehow. Any ideas about this? Doesredirectautomatically > > shuts down existingtransaction? > > > Thanks a lot --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
