Bonjour,

Comment ajouter LIMIT dans cette requête ? ou le placer exactement ?

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
<?php
 
require_once '../../inc/connection.php';
 
if (isset($_GET['term'])){
    $return_arr = array();
 
        $stmt = $pdo->prepare('SELECT nom_de_la_commune FROM communes_fr WHERE nom_de_la_commune LIKE :term ORDER BY nom_de_la_commune');
        $stmt->execute(array('term' => $_GET['term'].'%'));
        while($row = $stmt->fetch()) {
            $return_arr[] =  $row->nom_de_la_commune;
        }
 
    echo json_encode($return_arr);
}
 
?>
merci