Salve, sto facendo uno script in php utilizzando per interfacciarmi con il database mysql pdo, sto avendo problemi con l'execute. Aggiungo che è da poco che sto utilizzando PDO.
Il codice è questo:
Codice PHP:
$page = @$_GET['page'];
if(!isset($_GET['page']))
$page = 1;
$num_righe = 10;
$db->exec("set names utf8");
$risul = ( $page -1) * $num_righe;
$arr = array($risul, $num_righe);
// preparazione della query
$sql = $db->prepare("SELECT * FROM notizie_download WHERE tipo = 1 ORDER BY data DESC LIMIT ?, ?");
// esecuzione della query
$sql->execute($arr);
// creazione di un array dei risultati
print_r($sql->errorInfo());
La errorInfo mi stampa questo
codice:
Array ( [0] => 42000 [1] => 1064 [2] => 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 ''0', '10'' at line 1 )
Dove sta l'errore? Ringrazio tutti coloro che mi aiuteranno a risolvere il problema