daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest May 16th, 2018 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. date_default_timezone_set('Europe/Lisbon');
  2. $date = date("Y-m-d H:i:s");
  3.  
  4. // Ligação
  5. $conn = mysqli_connect($servername, $username,"",$dbname);
  6.  
  7.  
  8. $querypesquisa= "select * from praticar where titulo=titulo and texto=texto
  9.  and nome=nome";
  10. $querypesquisa_run = mysqli_query($conn,$querypesquisa);
  11.   ?>
  12.  <!DOCTYPE html>
  13. <html>
  14. <head>
  15.     <meta charset="UTF-8">
  16.     <title></title>
  17. </head>
  18. <body>
  19.     <?php
  20.     if(mysqli_num_rows($querypesquisa_run)>0)
  21.     {
  22.         // Loop vai ter a mesma quantidade que o nº de rows //
  23.           {
  24.         echo '
  25.     <h1>Titulo</h1>
  26.     <div>Conteudo</div>
  27.     <p></p>
  28.     <footer>MOSTRAR AQUI A VARIÁVEL DE DATA</footer><footer>Nome</footer>'
  29.          ; }
  30. }
  31. else
  32. {
  33.  echo 'Não existem noticias';
  34. }
  35.  
  36. ?>
  37. </body>
  38.    
  39. $nome = "AlmostDone";
  40. $query = "SELECT * FROM praticar WHERE nome = '$nome' ";
  41.    
  42. $querypesquisa= "select * from praticar";
  43.    
  44. <?php
  45.  
  46. date_default_timezone_set('Europe/Lisbon');
  47.  
  48. $date = date("Y-m-d H:i:s");
  49.  
  50. // Ligação
  51. $conn = mysqli_connect($servername, $username,"",$dbname);
  52.  
  53. $querypesquisa= "select * from praticar";
  54.  
  55. $querypesquisa_run = mysqli_query($conn, $querypesquisa);
  56.   ?>
  57.  <!DOCTYPE html>
  58. <html>
  59. <head>
  60. <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  61. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  62. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
  63.   <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
  64.     <meta charset="UTF-8">
  65.     <title></title>
  66. </head>
  67. <body>
  68.   <h1>Titulo</h1>
  69.     <div>Conteudo</div>
  70.  
  71.     <?php
  72.     while($row = mysqli_fetch_assoc($querypesquisa_run)){
  73.     ?>
  74.     <p>
  75.       <?php echo $row['id'] ?>-
  76.         <a href="#">
  77.         <?php echo $row['nome'] ?>
  78.         </a>
  79.    </p>
  80.     <footer><?php echo $row['data'] ?></footer>
  81. <button type="button" class="btn btn-sm btn-danger" href="#"
  82.     data-toggle="modal" data-target='#deleta_<?php echo $row['id'] ?>'>
  83.     <i class="fas fa-trash-alt"></i> Apagar</button>
  84.  
  85. <!-- Modal para deletar o equipamento !-->
  86.         <div class="container">
  87.         <div class="modal fade" id='deleta_<?php echo $row['id'] ?>' role="dialog">
  88.           <div class="modal-dialog modal-md">
  89.             <div class="modal-content">
  90.               <div class="modal-body">
  91.                 <p> Você tem certeza que deseja apagar o <?php echo $row['nome'] ?>?</p>
  92.               </div>
  93.               <div class="modal-footer">
  94.                     <a href="teste2.php?id=<?php echo $row['id'] ?>"
  95.                        class="btn btn-danger" id="delete">
  96.                         <i class="fas fa-eraser"></i> Apagar Registro</a>
  97.                     <button type="button" data-dismiss="modal" class="btn btn-primary">
  98.                         <i class="fas fa-times"></i> Cancelar</button>
  99.               </div>
  100.             </div>
  101.  
  102.           </div>
  103.         </div>
  104.       </div>
  105.   <?php }; ?>
  106.  
  107.  </body>
  108.  
  109. </html>
  110.    
  111. <a href="teste2.php?id=<?php echo $row['id'] ?>"..
  112.    
  113. <?php
  114. // Ligação
  115. $conn = mysqli_connect($servername, $username,"",$dbname);
  116.  
  117. $id = $_GET['id'];
  118.  
  119. $query_volta = "SELECT * FROM praticar";
  120. $query = mysqli_query($conn, $query_volta);
  121. $row_volta = mysqli_fetch_assoc($query);
  122. $id_volta = $row_volta['id'];
  123.  
  124.   //Cadastro de equipamentos
  125.   $query_deleta = "DELETE FROM praticar WHERE id=$id";
  126.   $resultado_deleta = mysqli_query($conn, $query_deleta);
  127.   $linhas = mysqli_affected_rows();
  128.  
  129.   if(mysqli_affected_rows() != 0){
  130.     echo "<script type="text/javascript">
  131.             alert("Equipamento apagado com sucesso.")";
  132.     header("Location: index.php");
  133.   }else{
  134.     echo 'Erro ao apagar o registro!';
  135.     header("Location: index.php");
  136.   }
  137. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top