gpt4 book ai didi

php - codeigniter 事件记录选择查询不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 12:17:24 27 4
gpt4 key购买 nike

我想从数据库中获取candidateindustry,为此我编写了以下内容:

 $candidateID = '1,2,3,4,5,6,7,8,9';

function get_industry($candidateID) {
$this->db->select('current_industry');
$this->db->group_by('current_industry');
$this->db->from('candidate_details');

$this->db->where_in('user_id', $candidateID);

$query = $this->db->get();
print_r($this->db->last_query());
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}

但是当我执行这个查询时,它只返回 9

first 候选人的行业

我不知道我在这里错过了什么..任何帮助或建议都会很有帮助..提前致谢..

最佳答案

你需要在 where_in 中将数据作为数组传递

$this->db->where_in('user_id', array(1,2,3,4,5,6,7,8,9));

在你的情况下试试

$this->db->where_in('user_id', explode(",",$candidateID));

关于php - codeigniter 事件记录选择查询不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21500035/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com