here my code -
$child1 = create_childid()."01";
$sqltree = "INSERT INTO tbltree (`userId`, `level`, `superId`, `rootId`, `childcount`)
VALUES ('$child1', '1', '$newid', '$myroot', '0');";
mysql_query($sqltree);
echo $newid;
update_level();
$child2 = create_childid()."02";
$sqltree = "INSERT INTO tbltree (`userId`, `level`, `superId`, `rootId`, `childcount`)
VALUES ('$child2', '1', '$newid', '$myroot', '0');";
mysql_query($sqltree);
update_level();
$child3 = create_childid()."03";
$sqltree = "INSERT INTO tbltree (`userId`, `level`, `superId`, `rootId`, `childcount`)
VALUES ('$child3', '1', '$newid', '$myroot', '0');";
mysql_query($sqltree);
update_level();
$child4 = create_childid()."04";
$sqltree = "INSERT INTO tbltree (`userId`, `level`, `superId`, `rootId`, `childcount`)
VALUES ('$child4', '1', '$newid', '$myroot', '0');";
mysql_query($sqltree);
update_level();
$child5 = create_childid()."05";
$sqltree = "INSERT INTO tbltree (`userId`, `level`, `superId`, `rootId`, `childcount`)
VALUES ('$child5', '1', '$newid', '$myroot', '0');";
mysql_query($sqltree);
update_level();
ERROR : update_level(); is executing only once why??