$tbl = $pdo->prepare( 'SELECT * FROM `posts` ORDER BY id DESC LIMIT 0, :limit ' ); $tbl->bindParam(':limit', $max); $tbl->execute();
i wyskakuje mi taki error:
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''0'' at line 1 in D:\xampp\htdocs\Webpage\posts.php:166 Stack trace: #0 D:\xampp\htdocs\Webpage\posts.php(166): PDOStatement->execute() #1 {main} thrown in D:\xampp\htdocs\Webpage\posts.php on line 166
Natomiast jeżeli dla przykładu dam
to wszystko działa
WHERE id = :LIMIT