-1
$department_id=19
$deptshead(17,19,3)
$sql_depthead ="SELECT * FROM nonaudit_employee WHERE status = 'Active' AND rights = 3 AND deptshead IN(".$department.")AND cand_id!= ".$cand_id;

its working fine but

it only match first dept head cant check the second dept value???

nnnnnn
  • 147,572
  • 30
  • 200
  • 241
  • Hint: the SQL *string* you are trying to create needs to be `"...AND deptshead IN(17,19,3) AND..."`, so think about how you would use `$deptshead` to create such a string... – nnnnnn Aug 26 '16 at 01:17
  • bro $depthead ids db field value .iam just show you. – Laxman palani Aug 26 '16 at 01:22
  • Array ( [0] => 12 [1] => 10 [2] => 17,19,3 [3] => 21,22 [4] => 13 [5] => 14 [6] => 5 [7] => 25 ) – Laxman palani Aug 26 '16 at 01:23
  • Array ( [0] => 12 [1] => 10 [2] => 17,19,3 [3] => 21,22 [4] => 13 [5] => 14 [6] => 5 [7] => 25 ) how to conver [3] and [2] vale also convert array a single array value – Laxman palani Aug 26 '16 at 01:25

1 Answers1

0

I'm not sure if I correct understood. You can try to use:

$inClause = implode(",", $deptshead);

And after that use $inClause var in your query

nnnnnn
  • 147,572
  • 30
  • 200
  • 241
weedget
  • 21
  • 5