php里用PDO的prepare,为什么不能替换表名称
展开全部
$count=$dbh->prepare("select * from ? where score<?");
$count->execute(array($table,$score));
$countNum=$count->rowCount();
返回$count=0
$count=$dbh->prepare("select * from {$table} where score<?");
$count->execute(array($score));
$countNum=$count->rowCount();
正常返回$count=45
$count->execute(array($table,$score));
$countNum=$count->rowCount();
返回$count=0
$count=$dbh->prepare("select * from {$table} where score<?");
$count->execute(array($score));
$countNum=$count->rowCount();
正常返回$count=45
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询