I am trying to bind a variable number of values into the IN ()
condition of my prepared statement AND bind a few more values later in the query, but I am getting an error:
PHP Fatal error: Cannot use positional argument after argument unpacking.
My code is as follows :
$ccarr=explode(",", $cc);
$in = str_repeat('?,', count($ccarr) - 1) . '?';
$op_r=$tfvarr[2];
$budg_et=$tfvarr[1];
$budg_et1=$tfvarr111111;
$sqldesk="SELECT subsubcatid_parent, plink, deskid, sum(itprice) as totprice FROM desktop_items a, items_table b, obsubsubcat c where subsubcatid_parent IN ($in) and a.itno = b.itno and a.subsubcatid_parent=c.subsubcatid group by subsubcatid_parent, deskid having totprice > ? && totprice ? ?" ;
if($stmtdesk = $conn->prepare($sqldesk))
{
$types = str_repeat('i', count($ccarr));
$types .= 'isi';
$stmtdesk->bind_param($types, ...$ccarr, $budg_et1, $op_r, $budg_et);
$stmtdesk->execute();
$stmtdesk->store_result();
$stmtdesk->bind_result($subsubcatid_parentdesk, $plinkdesk, $deskiddesk, $totpricedesk);
}
How can I bind all of the values without the unpacking error?