在为新表添加另一行时,在3个表中插入一行

$fcname = isset($_POST["name"]) ? $_POST["name"] : "";
$fcshortname = isset($_POST["shortname"]) ? $_POST["shortname"] : "";
$fctext = isset($_POST["text"]) ? $_POST["text"] : "";
$fcfullimg = isset($_FILES["fullimg"]) ? $_FILES["fullimg"] : "";
$fccountry = isset($_POST["country"]) ? $_POST["country"] : "";
$fcgame = isset($_POST["game"]) ? $_POST["game"] : "";
$fcfirst = isset($_POST["first"]) ? $_POST["first"]: "";
$fcsecond = isset($_POST["second"]) ? $_POST["second"] : "";
$fcthird = isset($_POST["third"]) ? $_POST["third"] : "";
$fcgroups = isset($_POST["groups"]) ? $_POST["groups"] : "";
$fcngroups = isset($_POST["ngroups"]) ? $_POST["ngroups"] : "";
$fcbrackets = isset($_POST["brackets"]) ? $_POST["brackets"] : "";
$fcnbrackets = isset($_POST["nbrackets"]) ? $_POST["nbrackets"] : "";
$fcbracketsmode = isset($_POST["bracketsmode"]) ? $_POST["bracketsmode"] : "";

$new_window = isset($_POST['new_window']) ? 1 : 0;

if(isset($_POST['safe'])) {

$query = safe_query("INSERT INTO `".PREFIX."leagues` (`name`, `shortname`, `addedon`, `text`, `fullimg`, `country`, `game`, `first`, `second`, `third`, `groups`, `ngroups`, `brackets`, `nbrackets`, `bracketsmode`, `sortid`, `activated`, `new_window`) VALUES ('$fcname', '$fcshortname', NOW(), '$fctext', '$fullimg_name', '$fccountry', '$fcgame', '$fcfirst', '$fcsecond', '$fcthird', '$fcgroups', '$fcngroups', '$fcbrackets', '$fcnbrackets', '$fcbracketsmode', '$sortid', 1, $new_window )");
            if($query) {
                redirect('admincenter.php?site=leagues',$_language->module['fc_added'],2);
            } else {
                echo $_language->module['fc_added_error'];
            }

}

This is my code right now. I need to insert a row in 3 brackets tables with the the value of ID (is AUTO_INCREMENT) from leagues tables.

normally i do like this, but now I dont know what I must put to replace $id in values.

safe_query("INSERT INTO `".PREFIX."brackets4` (`league`) VALUES ('$id')");
safe_query("INSERT INTO `".PREFIX."brackets8` (`league`) VALUES ('$id')");
safe_query("INSERT INTO `".PREFIX."brackets16` (`league`) VALUES ('$id')");

What should I do?

Well, I found the answer :D

$quera = mysql_query("SELECT id FROM `".PREFIX."leagues` ORDER BY id DESC LIMIT 1");
         while($res = mysql_fetch_array($quera)) {
               $ida = $res['id'];
               safe_query("INSERT INTO `".PREFIX."brackets4` (`league`) VALUES ('$ida')");
               safe_query("INSERT INTO `".PREFIX."brackets8` (`league`) VALUES ('$ida')");
               safe_query("INSERT INTO `".PREFIX."brackets16` (`league`) VALUES ('$ida')");
         }