mysqli multi query sepperation : I know you can run multiple queries with mysqli_multi_query but i have a problem.

For a registration page i want to perform 2 checks and then an insert.
Check1 = Does username exist?
Check2 = Email already been used?

If both checks are negative then do the insert query.

But how can i sepperate the errors,,  when a username exists it has to return 'Username already exists'    if email is already been used it has to return 'Email already in use'

here is my code:

    $sql = "check username query; ";
    $sql .= "check email query; ";
    $sql .= "Insert query";
    
    if (mysqli_multi_query($conn,$sql)) {
                do
                    {
                    if ($result=mysqli_store_result($conn)) {
                        while ($row=mysqli_fetch_row($result)) {
                            if (mysqli_num_rows($result) > 0) {
                                //DO STUFF
                                //Here do i need to return if the username or email exists or not.
                            };
                        mysqli_free_result($result);
                        };
                    } else {
                        echo 'Query fout!';
                    };
                while (mysqli_next_result($con));
                };
    
            mysqli_close($con);