Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $db = "artikel";
  7.  
  8.  
  9. $conn = new mysqli($servername, $username, $password, $db);
  10.  
  11.  
  12. $search = '';
  13.  
  14. if (array_key_exists('search', $_GET)) {
  15.  
  16. $search = $_GET['search'];
  17. }
  18. echo $search;
  19. if(isset($_POST['submit'])) {
  20. //$sql = "SELECT d_prijs, c_prijs, code, artikelNL FROM artikel WHERE '" . $_GET['input'] . " ' LIKE '%" . $_GET['input'] . "%' ";
  21. // $result = $conn->query($sql);
  22.  
  23. $sql = "SELECT d_prijs, c_prijs, code, artikelNL FROM artikel WHERE * LIKE '%" . $search . "%'";
  24. $result = $conn->query($sql);
  25.  
  26. if ($result = $conn->query($sql)) {
  27.  
  28. /* fetch object array */
  29. while ($row = $result->fetch_row()) {
  30. echo $row;
  31. }
  32.  
  33. /* free result set */
  34. $result->close();
  35. }
  36. }
  37. ?>
  38.  
  39.  
  40. <form method="get" action="">
  41. <input id="search" name="input" type="text" placeholder="search">
  42. <input type="submit" name="submit">
  43. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement