【发布时间】:2020-04-01 09:51:06
【问题描述】:
我有一个名为$req_dep 的数组数据。这是我var_dump()它时的样子。
array(2) { [0]=> int(41) [1]=> int(765) }
我想在查询中使用该数据
select * from dbo.RequisitionTable
where RequestorID = '$ID'
and RequestorDepartmentID in ($req_dep)
and IsProcessedToHire=0
and IsHold = 0
and IsRejected = 0
但它总是得到错误"Array to string conversion"。像这样的where条件下如何使用数组?
谢谢
【问题讨论】:
-
内爆它,或者更好的是使用codeigniter的活动记录并使用
$this->db->where_in() -
这能回答你的问题吗? Array to String PHP?
-
@Kevin idea 对我有帮助
标签: php sql sql-server codeigniter