Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <?php
  2. $servidor = "localhost";
  3. $user = "root";
  4. $senha = "";
  5. $banco = "faculdadesbd";
  6.  
  7. $mysqlli = new mysqli($servidor,$user,$senha,$banco);
  8.  
  9. if(mysqli_connect_errno()) trigger_error(mysqli_connect_error());
  10. else
  11. echo "sucesso";
  12.  
  13. @mysql_select_db("faculdadesbd",$mysqlli);
  14. ?>
  15. <html>
  16. <head>
  17. <title>Unigle</title>
  18. <style type="text/css">
  19. body{
  20. font-family:Verdana, Geneva, sans-serif;
  21. color:#333;
  22. font-size:12px;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <form action="" method="post" name="buscador">
  28. <input type="text" name="busca"/>
  29. <input type="submit" name="botao" value="Pesquisar"/>
  30. </form>
  31. <br />
  32. <hr />
  33. <br />
  34.  
  35. <?php
  36. if(isset($_POST['botao'])){
  37. $busca = $_POST['busca'];
  38.  
  39. $busca_dividida = explode(' ',$busca);
  40. $quant = count($busca_dividida);
  41.  
  42. for($i=0;$i<$quant;$i++){
  43. $pesquisa = $busca_dividida[$i];
  44.  
  45. $sql = ("SELECT * FROM busca WHERE nome_fac LIKE '%$.pesquisa.%'");
  46. $query = $mysqli->query($sql);
  47. while($linha = $query->fetch_assoc()){
  48. $nome_fac = $linha['Nome'];
  49. $data_vest = $linha['Data Vestibular'];
  50. $data_taxa = $linha['Data Taxa'];
  51. $nota_corte = $linha['Nota de corte'];
  52. $nota_enem = $linha['Nota ENEM'];
  53.  
  54. echo"
  55. <div class='resultado'>
  56. <h2>".$nome_fac."</h2>
  57. <p>".$data_vest."</p>
  58. <p>".$data_taxa."</p>
  59. <p>".$nota_corte."</p>
  60. <p>".$nota_enem."</p>
  61. </div>
  62. ";
  63. }
  64. }
  65. }
  66. ?>
  67.  
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement