2017-03-10 17:01
浏览 12


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));
            $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));
                <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>


i keep getting erros pealse help

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • doutizhou5312 2017-03-10 17:06

    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')
    解决 无用
    打赏 举报

相关推荐 更多相似问题