#生成预处理对象
$sql = 'SELECT * FROM dede_archives WhERE id IN (:id)' ;
$stmt = $pdo -> prepare($sql);
#参数的绑定并执行
$id = implode(',',[2,3,4,5,6,7,8,9]);
#$stmt -> bindParam(':id',$id,PDO::PARAM_STR);
$stmt -> bindValue(':id','2,3,4,5,6,7,8,9',PDO::PARAM_STR);
$stmt -> execute();
结果只能查询到id为2的数据,其他id的数据查询不到!
在传递这些多个值的时候或者多条件的时候应该怎样写;Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
拼接sql语句就好了