Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php while($dado = $con->fetch_array()) {?>
- <?php
- if(!empty($_FILES['uploaded_file'])){
- $username = 'root';
- $password = '';
- $connection = new PDO( 'mysql:host=localhost;dbname=nise', $username );
- $query = "INSERT INTO resposta_denuncia (descricao_resposta, imagem, id_usuario)
- VALUES (:descricao_resposta, :imagem, :id_usuario)";
- $statement = $connection->prepare($query);
- $path = "img_denuncia/";
- $path = $path . basename( $_FILES['uploaded_file']['name']);
- if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path))
- $valores = array();
- $valores[':descricao_resposta'] = $_POST['descricao_resposta'];
- $valores[':imagem'] = $_FILES['uploaded_file']['name'];
- $valores[':id_usuario'] = 2;
- if( $result = $statement->execute($valores))
- {
- echo 1; // dados enviados com sucesso
- }
- else
- {
- // na verdade o else não é necessário mas se preferir pode colocar
- echo 0; // erro ao tentar enviar dados
- }
- if($connection->connect_errno)
- echo"Falha na conexão:(".$connection->connect_errno.")".$connection->connect_error;
- $consulta = "SELECT id, data, descricao, imagem FROM denuncia ";
- $con = $connection->query($consulta) or die ($connection->error);
- }
- ?>
- <div class="card mb-3">
- <div id="wrapper">
- <div id="content-wrapper">
- <div class="container-fluid">
- <div class="card-body">
- <div class="table-responsive">
- <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
- <thead>
- <tr>
- <th id="id_bd">Nº</th>
- <th id="date">Data e hora</th>
- <th id="local">Local</th>
- <th id="comentario">Comentário</th>
- <th id="imagem">Imagem</th>
- </tr>
- </thead>
- <?php while($dado = $con->fetch_array()) {?>
- <tr>
- <td><?ph echo $dado["id"];?> </td>
- <td><?ph echo $dado["data"];?> </td>
- <td><?ph echo $dado["descricao"];?> </td>
- <td><?ph echo $dado["imagem"];?> </td>
- </tr>
- <?php }?>
- </table>
- </div>
- </div>
- <div class="card-footer small text-muted">Atualizado ontem às 11:59 PM</div>
- </div>
- </div>
- </div>
- </div>
Add Comment
Please, Sign In to add comment