How come this transaction goes through?

I’m trying to get transactions to work properly without success.

The following is the code, one of the sql-statements is broken on purpose($sql2)

but why does $sql1 still insert?

		$conn = yii::app()->db;

		$transaction = $conn->beginTransaction();



			$sql1 = "INSERT INTO tbl_test (Author, Comment)VALUES('TestAuthor','testComment')";

			$sql2 = "INSERT INTO tbl_test Comment VALUES('Comment')";







		catch(Exception $e)




Are you sure that tbl_test is INNODB table? You code looks fine.

Thanks m8 that was it, for some reason MyISAM was the engine for that particular table.

i agreed to Ivica…code looks fine. please check your table options for table tbl_test.