I was searching for a way to insert data into two database tables in a single query in such a way that if one failed, neither saved (I don\'t want orphaned data). I came ac
Make sure you're using an InnoDB table and not a MyISAM table, as MyISAM is not transactional.
To use an InnoDB table, when you create it, after the closing paren, add ENGINE=InnoDB. By default, MyISAM is used.
ENGINE=InnoDB