أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
Use LAST_INSERT_ID() from your SQL query or you can also use mysql_insert_id() to get it using PHP.
LAST_INSERT_ID() can be used to fetch latest auto increment id being used in any INSERT query that was just got executed.