It is the time to check the space that it is available or not. The new user that we will join a parent user and the side that we select, at that position, no user should available already. For this, we will create a function that will return true or false for space. First, we will create a table tree` to store all the tree structure information.
Function side_check
function side_check($email,$side){ global $con; $query =mysqli_query($con,"select * from tree where userid='$email'"); $result = mysqli_fetch_array($query); $side_value = $result[$side]; if($side_value==''){ return true; } else{ return false; } }