"php pdo error when using placeholders in the limit clause of a mysql query " Code Answer

5

i solved it.i type casted the :numrows placeholder.

$numrows=(int)$numrows; $sql = 'select sql_calc_found_rows * from ' . tbl_members .'order by'. $order .'limit :startrow,:numrows'; try { $st = $conn->prepare($sql); $st->bindvalue(":startrow", $startrow, pdo::param_int); $st->bindvalue(":numrows", $numrows, pdo::param_int); $st->execute();

and it worked. i also noticed the ' should be use instead of ".

By Diego Torres Milano on March 9 2022

Answers related to “php pdo error when using placeholders in the limit clause of a mysql query ”

Only authorized users can answer the Search term. Please sign in first, or register a free account.