[eluser]jedd[/eluser]
[quote author="Mel [RS]" date="1236803293"]
I can't leave the first query out of transaction 'cause if any of others query fails, i've to make a rollback.[/quote]
If the first query is just a select, then there's nothing to rollback from it. If you're relying on the result of that select (if that's all it is) then you might be better off trying to wrap up your updates/inserts/etc into a single query that includes the select component.
Quote:I hope have been more clear.
Don't take offence, but it's a bit hard to follow. Not sure if english is your native language - you're using abbreviations and wordage that suggests it is - but if that's the case, then you're not being especially clear. Re-reading that first message, I can't work out if you misspelt 'in case' or 'because', f.e. if english isn't your native language, then my apologies.
Quote:In resume, my problem is when I've the $id var, 'cause while the transaction not end, other users can have the same $id and that will cause a database error.
It'd be nice to know what the $id field refers to - because I can't see how other users might 'have the same one', and the idea of atomic or transactional database queries is that it doesn't matter what anyone else is doing - your transaction is guaranteed to work or not work in its entirety. The only database error you'll get is one you'll handle on the way out of the transaction - ie. by looking at trans_status(). Other users also implies they're present on other processes (separate instances of the web server, PHP, and consequently CI and the database session) which in turn implies insulation between these transactions and the variables you're using in same.