Problème d'utilisation dune barre de recherche php
koli85
Messages postés
2
Date d'inscription
Statut
Membre
Dernière intervention
-
jordane45 Messages postés 38486 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 38486 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour
j'ai fais un code ou tout les personnes que j'ai renseignez dans ma base de données s'affiche mais je sais pas pourquoi quand j'utilise la barre de recherche ca naffiche pas les noms que je veux soit avec la lettre a ou b
pourquoi??
<?php if(isset($_POST['search'])) { $valueToSearch= $_POST['valueToSearch']; $query = "SELECT * FROM `deliveries` WHERE LastName LIKE '".$valueToSearch."%'"; $search_result = filterTable($query); } else{ $query="SELECT * FROM `deliveries`"; $search_result = filterTable($query); } function filterTable($query) { $connect = mysqli_connect("localhost","root","","limeil"); $filter_Result=mysqli_query($connect, $query); return $filter_Result; } ?> <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"/> <script type="text/javascript" src="script.js"></script> <title>Fête du jardinage</title> <link rel="stylesheet" type="text/css" href="view.css"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div> <img src ="logo.png"> <h1>Fete du Jardinage 2023</h1> <a href="deconexion.php">Se déconnecter</a> </div> <header id="modal" style="display: none;"> <header id="modalContent"> <span id="closeModal">x</span> <form> <label id ="lastnameLabel" for="lastname">Nom : </label> <input id="lastname" type="text" name="lastname"> <label id ="firstnameLabel" for="firstname">Prénom : </label> <input id="firstname" type="text" name="firstname"> <label id ="streetnumberLabel" for="streetnumber">N°Rue : </label> <input id="streetnumber" type="number" name="streetnumber" min="1"> <label id ="StreetLabel" for="street">Rue : </label> <input id="street" type="text" name="street"> <label id ="commentlabel" for="coment">Commentaire : </label> <input id="comment"></textarea> <label id ="deliveredLabel" for="delivered">Remis : </label> <input id="delivered" type="checkbox" name="delivered"> <input id="create" type="button" value="Créer"> </form> </header> </header> <div id="sureModal"> <header id="sureModalContent"> <p>Etes-vous sûr de vouloir supprimer cette ligne ?</p> <header id="sureButtons"> <button id="sureYes">Oui</button> <button id="sureNo">Non</button> </div> </div> </div> <main> <header id="top"> <header> <label for="valueToSearch">Recherche :</label> <input type="text" name="valueToSearch" placeholder=""> <label for="searchType">Rechercher par :</label> <select id="searchType" name="searchType"> <option value="name">Nom/Prénom</option> <option value="adress">Adresse</option> </select> </header> <button id="new">Nouveau Brévannais</button> </header> <header> <table id="table"> <tbody> <table> <tr> <th>ID</th> <th>Nom</th> <th>Prénom</th> <th>N° Rue</th> <th>Rue</th> <th>Commentaire 2023</th> <th>Remis</th> <th>Remise 2023</th> <th>Commentaire 2022</th> <th>Remise 2022</th> </tbody> </tr> <?php while($row = mysqli_fetch_array($search_result)):?> <tr> <td><?php echo $row['ID'];?></td> <td><?php echo $row['LastName'];?></td> <td><?php echo $row['FirstName'];?></td> <td><?php echo $row['StreetNumber'];?></td> <td><?php echo $row['Street'];?></td> <td><?php echo $row['Comment2020'];?></td> <td><?php echo $row['Delivered'];?></td> <td><?php echo $row['DeliveryDate2020'];?></td> <td><?php echo $row['Comment2021'];?></td> <td><?php echo $row['DeliveryDate2021'];?></td> </tr> <?php endwhile;?> </table> </form> </table> </header> </main> </body> </html>
A voir également:
- Problème d'utilisation dune barre de recherche php
- Télécharger gratuitement notice d'utilisation - Guide
- Recherche automatique des chaînes ne fonctionne pas - Guide
- Windows 11 barre des taches a gauche - Guide
- Recherche a partir dune photo - Guide
- Barre de défilement - Guide