Innodb transaction problem

I read in the book High Performance MySQL, Second Edition that innodb transactions are reliable but its not the same case on my side. On my website i am sending three sql commands to mysql server.
2 Inserts, and one update. Innodb skip the update sql (MOST of the time, NOT all the time) and commits the transaction.

I am using set autocommit = 1 and here are mysql statements


Q1: INSERT INTO files (file_title, ‘file_date’) VALUES(‘new file’, NOW());

$id = mysql_insert_id();
Q2: UPDATE user_info SET total_media=total_media+1, file_size=$file_size WHERE id=13;
Q3: INSERT INTO keywords (file_id, keyword) VALUES ($id, ‘keyword’)

if(mysql_query->query($q1) && mysql_query($q2) && mysql_query($q3)) {

else {

Above code is just for understanding and all numeric fields are Integers.

Please help me on this.


Some dataabse class?

Anyways, the error is in your code. InnoDB would not be deployed anywhere if it would not return an error if UPDATE fails.

Note that COMMIT and ROLLBACK do not have any use if autocommit=1. Read

sorry about that typo, its mysql_query, there is no code error. As far as I know commit should work with begin or start transaction.