My tables are innoDB? transactions work on these kind of MySQL Tables?

sitepoint Lorna advanced cut edge php : ebook & Learnable
ch.2 databases
this code seems no work - my tables are innoDB? transactions work on these kind of MySQL Tables???

<?php
try {
  $db_conn = new PDO('mysql:host=localhost;dbname=recipes', 'root', '');
} catch (PDOException $e) {
  echo "Could not connect to database";
  exit;
}

try {
  // start the transaction
  $db_conn->beginTransaction();

  $db_conn->exec('UPDATE categories SET id=35 WHERE name = "Pudding"');
  $db_conn->exec('UPDATE recipes SET category_id=19 WHERE category_id=18');

  // we made it!
  $db_conn->commit();

} catch (PDOException $e) {
  $db_conn->rollBack();
  echo "Something went wrong: " . $e->getMessage();
} catch (Exception $e) {
  $db_conn->rollBack();
  echo "Something went wrong: " . $e->getMessage();
}
?>