title: Check if sql statement has been excuted
body: <p>How to check if sql statement has been executing before executing another SQL statement.</p>
  
  <p>I make like this </p>
  
  <pre><code> DECLARE tempId double default 2;
   insert IGNORE  into  `system_users`( `user_id`,`username`,`password`) values (id , userName ,md5(password)) ;
  
    set tempId= last_insert_id();
  
    IF tempId &lt;&gt; 0 THEN     
          insert into  `user_profile`(`user_id`, `full_name`, `cellphone`, `Date_time_ added`,`added_by`) values (id, fullName ,cellPhone , CURRENT_TIMESTAMP(),addedBy ) ;
  </code></pre>
  
  <p>function last_insert_id() doesn't work with my case because user_id is not auto increment pk, it's the identification number fot the user. what is the function that is used to test execution of sql statement.</p>