You can do like this:
$sql = SELECT * FROM tbl_news ORDER BY date DESC LIMIT :start, :rows";
$q = $db->prepare($sql);
$q->bindParam(':start', $start, PDO::PARAM_INT);
$q->bindParam(':rows',$rows, PDO::PARAM_INT);
More Related Contents:
- PHP – Using PDO with IN clause array
- LIMIT keyword on MySQL with prepared statement [duplicate]
- pdo prepared statements with wildcards
- Can I use a PDO prepared statement to bind an identifier (a table or field name) or a syntax keyword?
- Insert multiple rows with PDO prepared statements
- Replacing mysql_* functions with PDO and prepared statements
- PDOstatement (MySQL): inserting value 0 into a bit(1) field results in 1 written in table
- Calling stored procedure with Out parameter using PDO
- When *not* to use prepared statements?
- PDO error: SQLSTATE[HY000]: General error: 2031
- Use of PDO in classes [duplicate]
- Can I mix MySQL APIs in PHP?
- Can I bind an array to an IN() condition in a PDO query?
- PDOException “could not find driver”
- PDO get the last ID inserted
- How do I use password hashing with PDO to make my code more secure? [closed]
- MySQLi prepared statements error reporting [duplicate]
- PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers
- Insert/update helper function using PDO
- How to bind parameters to a raw DB query in Laravel that’s used on a model?
- Is “SET CHARACTER SET utf8” necessary?
- Retrieve (or simulate) full query from PDO prepared statement
- Set PDO to throw exceptions by default [duplicate]
- PDO: MySQL server has gone away
- return multiple response data in one response
- How to get a query error from prepare() in PDO PHP?
- PHP PDO how to run a multiple query request?
- PDO bindParam into one statement?
- What is the PDO equivalent of function mysql_real_escape_string?
- Installing PDO driver on MySQL Linux server