MySQL mysqli_stmt_bind_param与数组

时间:2018-09-24 23:58:53

标签: php mysql arrays mysqli

我正在尝试删除ID并非数组元素的记录。但是我发现“ mysqli_stmt_bind_param”函数存在问题。我应该如何设置代码?

$idSite = 6;
$eraseCats = array(5,1);
eliminateCats($idSite,$eraseCats);


function eliminateCats($idSite,$eraseCats) {
    global $connect;
    $typebind = 'iii';
    $statement = mysqli_prepare($connect, "DELETE FROM categories WHERE site_id = ? AND id_catsite NOT IN ? ");
    array_unshift($eraseCats, $idSite);
    $params = array_merge(array($typebind), $eraseCats);
    foreach( $params as $key => $value ) {
        $params[$key] = &$params[$key];
    }
    call_user_func_array(array($statement, "mysqli_stmt_bind_param"), $params);
    mysqli_stmt_execute($statement);
    mysqli_stmt_close($statement);           
}

0 个答案:

没有答案