title: Variables in stored procedure MySQL
body: <p>I got a problem with this SIMPLE stored procedure. I want to save <em>LAST_INSERT_ID</em> in a variable and then assign it for next insert.</p>
  
  <pre><code>    DELIMITER //
      CREATE PROCEDURE Adda(
         Name varCHAR(45),Surrname varCHAR(45),City varCHAR(45),PhoneNumber varCHAR(45),photo varCHAR(45))
      BEGIN
      START TRANSACTION;
         INSERT INTO Personal(Name,Surrname)
         VALUES(Name,Surrname);
         INSERT INTO Addres(Id_Personal_Address,Country, City) 
         VALUES(LAST_INSERT_ID(),Country,City);
  --i think here i should assign LAST_INSER_ID to variable
          INSERT INTO Images(Id_Personal_Address,photo)
          VALUES(Photo); -- and here use it
      COMMIT;
      END//
      DELIMITER ;
  </code></pre>
  
  <p>I really don't know how to do this.</p>