title: Get the Unique ID for the Last Inserted Row
body: <p>I want to get the Unique ID for the Last Inserted Row inside stored procedure, I make like this</p>
  
  <pre><code>DELIMITER //
   CREATE PROCEDURE addNewUsers(IN userName varchar(128),IN password varchar(128), IN addedBy INT)
  
  BEGIN
  
   DECLARE id int default 0;
  
    id = mysqli_insert_id (insert into  `system_users`( `username`,`password`) values (userName ,md5(password)) );
    IF id &lt;&gt; 0 THEN     
          insert into  `user_profile`( `full_name`,`Date_time_ added`,`added_by`) values (userName ,CURRENT_TIMESTAMP(),addedBy ) where `user_id`=id ;
    END IF
  
  
  END //
  
  DELIMITER ;
  </code></pre>
  
  <p>This error occur</p>
  
  <pre><code>  #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 '= mysqli_insert_id (insert into `system_users`( `username`,`password`) values (' at line 7
  </code></pre>
  
  <p>I doubt it's from <code>mysqli_insert_id </code>, what should I do ?</p>