Update Where IN integer list
I'm getting the following error
UPDATE access_userlogin SET sg_leader = ? WHERE userlogin_id IN ?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1
if (!function_exists('getAllColumns')) {
function getAllColumns($rs,$col) {
$allColumns = "";
for ($x=0; $x<sizeof($rs->Results); $x++) {
if ($allColumns) $allColumns .= ", ";
$allColumns .= $rs->Results[$x][$col];
}
return $allColumns;
}
}
$updated_leaders = new WA_MySQLi_RS("updated_leaders",$local_i,0);
$updated_leaders->setQuery("SELECT sg_smallgroup.leader FROM sg_smallgroup WHERE sg_smallgroup.smallgroup_start_date < ? AND (sg_smallgroup.smallgroup_end_date > ? OR sg_smallgroup.smallgroup_end_date IS NULL)");
$updated_leaders->bindParam("t", "".(date('Y-m-d', strtotime("-2 weeks"))) ."", "-1"); //WAQB_Param1
$updated_leaders->bindParam("t", "".(date('Y-m-d', strtotime("+2 weeks"))) ."", "-1"); //WAQB_Param2
$updated_leaders->execute();
if ("" == "") {
$UpdateQuery = new WA_MySQLi_Query($local_i);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "access_userlogin";
$UpdateQuery->bindColumn("sg_leader", "i", "1", "WA_DEFAULT");
$UpdateQuery->addFilter("userlogin_id", "IN", "il", "".(getAllColumns($updated_leaders, "leader")) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
I'm pretty certain the problem is with
$UpdateQuery->addFilter("userlogin_id", "IN", "il", "".(getAllColumns($updated_leaders, "leader")) ."");
How can I make this work?