Advertisement
Guest User

Untitled

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