<?php
// Connect to MySQL database
include("dbConfig.php");


// Get the position of the specific row
$sql = "SELECT level FROM hr_advance_level_tbl WHERE id = 9";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$level = $row["level"];

// Increment the position of all rows after the specific row
$sql = "UPDATE hr_advance_level_tbl SET level = level + 1 WHERE level >= $level";
$conn->query($sql);

// Insert a new row with the position of the specific row
$sql = "INSERT INTO hr_advance_level_tbl (company_id, dept_id, employ_id, level) VALUES ('321', '321', '321', $level)";
$conn->query($sql);

// Close MySQL connection
$conn->close();
?>