Advertisement
Guest User

Untitled

a guest
Feb 6th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <form action="fullridez.php">
  2. <h4 id="Filter">GPA</h4>
  3. <input id="FilterBox" name="gpa" type="text"/>
  4. <h4 id="Filter">Amount</h4>
  5. <input id="FilterBox" name="amount" type="text"/>
  6. <h4 id="Filter">School</h4>
  7. <input id="FilterBox" name="school" type="text"/>
  8. <button type="submit" id="FilterBox" onkeypress="checkEnter()" >
  9. <img src="search.png" width=15 height=15 />
  10. </button>
  11. </form>
  12. <script>
  13. </script>
  14.  
  15. <?php
  16. $servername = "MariaDB";
  17. $username = "root@localhost";
  18. $password = ;
  19. $database = "scholarshipslist";
  20.  
  21. $gpa = $_GET["gpa"];
  22. $amount = $_GET["amount"];
  23. $school = $_GET["school"];
  24. // Create connection
  25. $conn = new mysqli($servername, $username, $password, $database);
  26.  
  27. // Check connection
  28. if ($conn->connect_error) {
  29. die("Connection failed: " . $conn->connect_error);
  30. }
  31. echo "Connected successfully";
  32.  
  33. $count = "SELECT 'id', 'school', 'gpa', 'amount' FROM 'scholarships'";
  34. $result = $conn->query($count);
  35.  
  36. if ($result->num_rows > 0) {
  37. // output data of each row
  38.  
  39. $sql = "SELECT * FROM 'scholarships' WHERE 'gpa' <= '".$gpa."'
  40. 'amount' <= '".$amount." 'school' == '" .$school."'";
  41.  
  42. if (mysqli_query($conn, $sql)); {
  43.  
  44. }
  45. echo $result;
  46. } else {
  47. echo "0 results";
  48. }
  49. $conn->close();
  50.  
  51. <table>
  52. <tr><td>Col 1</td><td>Col 2</td><td>Col 3</td></tr>
  53. <?php
  54. while($row = mysql_fetch_assoc($result))
  55. {
  56. echo "<tr><td>"
  57. . $row['col_1'] . "</td><td>"
  58. . $row['col_2'] . "</td><td>"
  59. . $row['col_3'] . "</td></tr>";
  60. }
  61. ?>
  62. </table>
  63.  
  64. <?php
  65. $num_rows = mysql_num_rows($result);
  66. for ($i=0;$i<$num_rows;$i++) { //loop through all rows of data
  67. $row = mysql_fetch_assoc($result); // your data is now: $row['fieldName']
  68.  
  69.  
  70. ?>
  71. <div>
  72. GPA <input name="" value="<?php echo($row['gpa'])?>;" type="text">
  73. AMOUNT <input name="" value="<?php echo($row['amount'])?>;" type="text">
  74. SCHOOL <input name="" value="<?php echo($row['school'])?>;" type="text">
  75. </div>
  76. <?php
  77. } //end of the loop
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement