Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10',12' at line 1' in /home/www-data/www/test/load.php:25 Stack trace: #0 /home/www-data/www/test/load.php(25): PDOStatement->execute() #1 {main} thrown in /home/www-data/www/test/load.php on line 25
$sql = $db->prepare("SELECT id,name,year,main_role,description FROM movies ORDER BY id DESC LIMIT ?,12");
$sql->bindValue("1",$num,PDO::PARAM_INT);
$sql->execute();
if ($sql->rowCount() > 0)
{
while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
$data[] = $row;
}
echo json_encode(array('status' => 'succes','data' => $data));
}
Ребят, подскажите в чём может быть проблема?