在php中的sql查询中不使用

i have two sql tables >> requests and services provider what i am trying to do is to check if services provders id exists in requests table i would like to only show other service provider ids that from service provider table excepts the ones in the requests table .. how to do so
my code is as follows :

$query_req="SELECt * FROM requests WHERE ongoing='0'";
            $result_req=mysqli_query($dbc,$query_req) or die(mysqli_error($dbc));
            while($row_req=mysqli_fetch_array($result_req)){
            $query_sp="SELECT * FROM service_provider WHERE id NOT IN $row_req[service_provider_id]";
            $result_sp=mysqli_query($dbc,$query_sp)or die(mysqli_error($dbc));
            while($row_sp=mysqli_fetch_array($result_sp)){
            ?>
            <tr>
                <td><img src="<?php echo $row_sp['picture']; ?>" alt="" /></td>
                <td class="cart-title"><a href="#"><?php echo $row_sp['name']; ?></a></td>
                <td><?php echo $row_sp['wage_hour']; ?></td>
                <td><?php echo $row_sp['rating']; ?></td>
                <td><a href="confirm_request.php?id=<?php echo $row_sp['id']; ?>" class="button color ">Request Skillfull</a></td>
                </tr>
                <?php
                }

                    }
                      ?>

i keep getting erros pealse help

Try this. It gonna select all the services_providers where the id not be in request ongoing='0'

SELECT * FROM service_provider WHERE id NOT IN (SELECT id FROM requests WHERE ongoing='0')