$db = new mysqli("localhost", "", "", "");
$db->autocommit(FALSE);
if ($db->query("INSERT ..."))
$db->commit();
else
$db->rollback();
Make sure your tables use the engine InnoDB: MyISAMdoes not support transactions.
:
InnoDB , MySQL, - MyISAM.
MySQL InnoDB, , .
MySQL InnoDB .