Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="GET" class="form-inline align-self" style="margin-left:2%; margin-top:15px;">
- <div class="input-group mb-2 mr-sm-2 mb-sm-0">
- <div class="input-group-addon">Where?</div>
- <select class="custom-select mb-2 mr-sm-2 mb-sm-0 form-control" name="choice">
- <option selected> <?php echo(isset ($_GET["choice"]))?$_GET["choice"]:"Choix..";?></option>
- <option value="PROJECT">Projet</option>
- <option value="ACCOUNT">Utilisateur</option>
- </select>
- </div>
- <button type="submit" class="btn btn-primary">Valider</button>
- <?php
- if (isset( $_GET['choice'] )) {
- ?>
- <div class="input-group mb-2 mr-sm-2 mb-sm-0">
- <div class="input-group-addon">Table?</div>
- <select class="custom-select mb-2 mr-sm-2 mb-sm-0 form-control" name="table">
- <option selected>Choix..</option>
- <?php
- $req = getDB()->prepare('SELECT * FROM '.$_GET['choice'].';');
- $req -> execute();
- $row = $req->fetch(PDO::FETCH_ASSOC);
- foreach ($row as $key => $value) {
- echo '<option>'.$key.'</option>';
- }
- $req->closeCursor();
- ?>
- </select>
- </div>
- <input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" name="search" placeholder="mot clef de recherche">
- <button type="submit" class="btn btn-primary">Rechercher</button>
- <?php
- if (isset( $_GET['table'] )) {
- ?>
- <div class="zone container" style="margin-left:2%;margin-bottom:2%;width: 96%;overflow: scroll;height: 500px">
- <table class="table table-bordered table-hover">
- <thead>
- <tr>
- <?php
- $req = getDB()->prepare('SELECT * FROM '.$_GET['choice'].' WHERE '.$_GET['table'].' = '.$_GET['search'].';');
- $req -> execute();
- $row = $req->fetch(PDO::FETCH_ASSOC);
- foreach ($row as $key => $value) {
- echo '<th>'.$key.'</th>';
- }
- echo "</tr>
- </thead>
- <tbody>";
- $req -> execute();
- while ($row = $req->fetch(PDO::FETCH_ASSOC)) {
- echo '<tr>';
- foreach ($row as $key => $value) {
- echo '<td>'.$value.'</td>';
- }
- echo '</tr>';
- }
- $req->closeCursor();
- ?>
- </tbody>
- </table>
- <?php
- }
- else {
- echo'
- <div class="zone container" style="margin-left:2%;margin-bottom:2%;width: 96%;overflow: scroll;height: 500px">
- <h5 style="text-align:center"> Il manque des paramètres </h5>
- ';
- }
- }
- else {
- echo'
- <div class="zone container" style="margin-left:2%;margin-bottom:2%;width: 96%;overflow: scroll;height: 500px">
- ';
- }
- ?>
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement