$ Count $ dbh-& amp; gt; prepare (& quot; select * from? Wherescore & amp; lt ;? & Quot;); $ count-& amp; gt; execute (array ($ table, $ score); $ countNum $ count-& amp; gt; rowCount (); returns $ count0 $ count $ dbh-& amp; gt; prepare (& quot; select * from {$ table} whe... $ count = $ dbh-> prepare ("select * from? Where score $ Count-> execute (array ($ table, $ score ));
$ CountNum = $ count-> rowCount ();
Returns $ count = 0.
$ Count = $ dbh-> prepare ("select * from {$ table} where score $ Count-> execute (array ($ score ));
$ CountNum = $ count-> rowCount ();
$ Count = 45
Reply content:
$ Count = $ dbh-> prepare ("select * from? Where score $ Count-> execute (array ($ table, $ score ));
$ CountNum = $ count-> rowCount ();
Returns $ count = 0.
$ Count = $ dbh-> prepare ("select * from {$ table} where score $ Count-> execute (array ($ score ));
$ CountNum = $ count-> rowCount ();
$ Count = 45
The controllable part does not need to be substituted. Do you rely on user input for table names?
Prepare Statement
Is to pre-compile the input parameters, not allSQL
All characters can be replaced by placeholders. Only those that meet the parameter conditions can be used for pre-compilation.
It doesn't make much sense to add a table name to prepare, because in case you cannot submit the input, it is completely filled in by yourself, and it should be a constant that cannot be modified, and there is no need for prepare.