I'm trying to get this to work. I'm getting 5 userid's from a multiple select box. I now insert these 5 users into my dbtable like this: foreach ($_GET['multiple1'] as $userid) { $result = $db->sql_query("INSERT INTO ".$prefix."_user_ref (old_userid) VALUES ('$userid')"); } PHP: This part works fine, and what that does is it gives the user a new userid in my table. My table is set with 2 fields (old_userid, new_userid). The new userid is made with auto_increment. Now my issue here is that I want to insert the users with the new userid into another table aswell within the same foreach{}. How do I get the new userid and then insert again in another table... Hope somebody can help...