Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('database_pesquisa.php');
- include('converte_data.php');
- ?>
- <!DOCTYPE html>
- <html lang="pt-br">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
- <title>Sistema de Busca</title>
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
- </head>
- <style>
- body {
- font-family: 'Poppins', sans-serif;
- font-size: 15px;
- }
- </style>
- <body>
- <div class="container">
- <div class="row">
- <div class="col-sm-10">
- <br><br>
- <h3>Pesquisa</h3>
- <form action="">
- <table>
- <tr>
- <td><input name="busca" class="form-control" size="64" value="<?php if(isset($_GET['busca'])) echo $_GET['busca']; ?>" placeholder="Qual filme deseja pesquisar?" type="text"></td>
- <td></td>
- <td><button type="submit" class="btn btn-primary">Pesquisar</button></td>
- </tr>
- </table>
- </form>
- <br>
- <table class="table table-hover">
- <thead>
- <tr>
- <th scope="col">Ano de lançamento</th>
- <th scope="col">Filme</th>
- <th scope="col">Data de postagem</th>
- <!--<th scope="col">#</th>-->
- </tr>
- </thead>
- <?php
- if (!isset($_GET['busca'])) {
- ?>
- <tr>
- <td colspan="3"></td>
- </tr>
- <?php
- } else {
- $pesquisa = $mysqli->real_escape_string($_GET['busca']);
- $sql_code = "SELECT *
- FROM nomedatabela
- WHERE nome LIKE '%$pesquisa%'
- OR sinopse LIKE '%$pesquisa%' ORDER BY id DESC";
- $sql_query = $mysqli->query($sql_code) or die("ERRO ao consultar! " . $mysqli->error);
- if ($sql_query->num_rows == 0) {
- ?>
- <tr>
- <td colspan="3">Nenhum resultado encontrado...</td>
- </tr>
- <?php
- } else {
- while($dados = $sql_query->fetch_assoc()) {
- ?>
- <tbody>
- <tr>
- <td><?php echo $dados['ano_lancamento']; ?></td>
- <td><a href='filme/<?php echo $dados["slug"]; ?>'><?php echo $dados["nome"]; ?></a></td>
- <td><?php echo converte_data($dados['data_cadastro']); ?></td>
- <!--<td><a href='<?php echo $dados["url"]; ?>' target="_blank"><?php echo $dados["nome"]; ?></a></td>-->
- <!--<td><?php echo "<a href='apagar.php?id=" . $dados['id'] . "'>Apagar</a>"; ?></td>-->
- </tr>
- </tbody>
- <?php
- }
- }
- ?>
- <?php
- } ?>
- </table>
- <br><br><br>
- <a href="inicio">Página inicial</a>
- <br><br><br><br>
- </div>
- <div class="col-sm-2"><br><br>
- <h2><b>Sobre o site</b></h2>
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod</p>
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod. Duis aute irure dolor in reprehenderit in voluptate</p>
- <p></p>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement