title: Rollback transaction on error
body: <p>I am using this query to add rows in two different column </p>
  
  <pre><code>    START TRANSACTION;
     SET @c=0;
  
     INSERT INTO tbl_chart (acode,adesc)  VALUES (2,'3');
     INSERT INTO tbl_pics  (ID ,adesc) VALUES (1,'1');
     select ROW_COUNT() into @c ;
  
     IF ( c &gt; 0) THEN
         COMMIT ;
     ELSE 
         ROLLBACK;
     END IF
  </code></pre>
  
  <p>and trying to check row_count and save its value in variable c .
  But this query gives error and it also saves the data after showing the error .
  where is the problem ?</p>
  
  <p>And the error is this :</p>
  
  <pre><code>    /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF ( c &gt; 0) THEN
  COMMIT' at line 1 */
  </code></pre>