Bonjour,

j'ai un message d'erreur :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 MySQL server version for the right syntax to use near 'OFFSET 12' at line 3

et voici le retour sql :

SELECT id_service_public,id_data,code_insee,date_maj,pivot_local,type_service_public FROM servicepublic WHERE pivot_local = "ADEME" OFFSET 12

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public function getListGroupByPivotF($pivot = null, $debut = -1, $limite = -1)
{
    $listeService = array();
 
    $sql = 'SELECT id_service_public,id_data,code_insee,date_maj,pivot_local,type_service_public FROM servicepublic';
 
    if ($pivot)
        $sql .= ' WHERE pivot_local = "'.$pivot.'"';
    else
        $sql .= ' GROUP BY pivot_local';
 
    if ((int) $debut > 0)
        $sql .= ' LIMIT ' . (int) $debut;
    if ((int) $limite > 0)
        $sql .= ' OFFSET ' . (int) $limite;
 print_r($sql);
    $requete = $this->db->query($sql);
 
    while ($Service = $requete->fetch(PDO::FETCH_ASSOC))
        $listeService[] = new ServicePublic ($Service);
 
    $requete->closeCursor();
 
    return $listeService;
}

merci pour votre aide.