不是PDO的bug,是PDO的规则如此。 使用PDO需要注意几种情况1.不能让占位符 ? 代替一组值,如:select * from table where id in(?);就是你遇到的情况,当是一组值时,只会取第一个值。2.不能让占位符代替数据表名或列名,如:select * from table order by ?; 3.不能让占位符 ? 代替任何其他SQL语法,如:select extract(? from addtime) as dt from table;
正解! 所以 tid in ( ? ) 可写作 find_in_set( tid, ? )
to fdipzone 非常感谢,回复很清楚!能否告诉个连接告诉这些从哪作搜索到的?我想进一步了解下,还有什么特别的规则。
使用PDO需要注意几种情况1.不能让占位符 ? 代替一组值,如:select * from table where id in(?);就是你遇到的情况,当是一组值时,只会取第一个值。2.不能让占位符代替数据表名或列名,如:select * from table order by ?;
3.不能让占位符 ? 代替任何其他SQL语法,如:select extract(? from addtime) as dt from table;
所以 tid in ( ? )
可写作 find_in_set( tid, ? )