Simply said it's imposible to use nested transaction using pdo (and maybe most of the php database library) for php.
but from the command line you can however, use mysql savepoint and rollback to savepoint to stimulate nested transactions for example
-- parent sql goes here
-- nested sql goes here
ROLLBACK TO SAVEPOINT save_id1
hope this would be usefull..