Bonjour, j'ai un pb avec l'une de mes requêtes SQL. En fait je travaille en PDO(PHP Data Object).
Voici une partie du code du fichier class.inc.php:
class subjectTable {
public $selectAll;
public function __construct($db) {
$this->selectAll = $db->prepare("SELECT * FROM sujets_de_forum ORDER BY date_postage ASC LIMIT ?, ? "); //ligne 200
}
public function selectAll($offset, $lignes) {
$this->selectAll2->execute(array($offset, $lignes));
}
}
Dans le fichier forum.php j'appelle la fonction selectAll de cette facon:
$db = new MyPDO(HOST_DB, USER, PASS);
$subjectTable = new subjectTable($db);
$subjectTable->selectAll2($debut, $nb_message); // $debut et $nb_message etant des entiers. ligne 85
mais j'obtients l'erreur suivante:
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 ''0', '10'' at line 1' in C:\xampp\htdocs\lymen\includes\class.php:200 Stack trace: #0 C:\xampp\htdocs\lymen\includes\class.php(200): PDOStatement->execute(Array) #1 C:\xampp\htdocs\lymen\forum.php(85): subjectTable->selectAll2(0, 10) #2 {main} thrown in C:\xampp\htdocs\lymen\includes\class.php on line 200
