RT 小白真心求教!!!!!!

解决方案 »

  1.   

    表名不能使用占位符1.不能让占位符 ? 代替一组值,这样只会获取到这组数据的第一个值,如:
    select * from table where userid in ( ? );  
    如果要用in來查找,可以改用find_in_set()实现$ids = '1,2,3,4,5,6';  
    select * from table where find_in_set(userid, ?);  2.不能让占位符代替数据表名或列名,如:
    select * from table order by ?;  3.不能让占位符 ? 代替任何其他SQL语法,如:
    select extract( ? from addtime) as mytime from table;  参考:http://blog.csdn.net/fdipzone/article/details/22330345
      

  2.   

    这个是pdo规定的,如果你想表名是变量,可以改成$sqlstr = "select * from ".$table." where id=?";
    这种方式。