我在 mysqli 查询中使用 IN 时遇到问题。到目前为止的代码是:
//to get array from first db
$c=array();
$q_query="SELECT * FROM is_user_detail_db WHERE company_name LIKE '%$q%'";
$q_result=mysqli_query($dbc, $q_query) or die("Could not get company name");
while($q_row=mysqli_fetch_assoc($q_result))
{
$c[]=$q_row['user_id'];
}
//second query
$ids=join(',', $c);
$queryc="SELECT * FROM archive_agent_booking WHERE user_id IN ($ids)";
$resultc=mysqli_query($dbc, $queryc) or die("Could not access db");
while($rowc=mysqli_fetch_array($resultc))
{
...get returned data
}
我得到的只是死亡声明,“无法访问数据库”。