ERRO em Consulta PDO
Olá pessoal, bom estou estudando php pelo manual ,como falei em um tópico anterior , estou aprendendo o básico ainda, estou passando um pequeno script para PDO e estou com o seguinte erro
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 MariaDB server version for the right syntax to use near '-5, 5' at line 1' in C:\xamppp\htdocs\modcp.php:296 Stack trace: #0 C:\xamppp\htdocs\modcp.php(296): PDOStatement->execute() #1 {main} thrown in C:\xamppp\htdocs\modcp.php on line 296
este é meu código
$num_items = $noi[0]; //changable
$items_per_page= 5;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT id, name, text, authorid, crdate FROM fun_topics WHERE reported='1' ORDER BY crdate DESC LIMIT $limit_start, $items_per_page";
$items = $tonn->prepare($sql);
$items->execute();
Se alguém puder me da uma dica do que pode ser, ficarei gratoDiscussão (7)
Carregando comentários...