Guest User

Untitled

a guest
Jan 31st, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <?php
  2. //load database connection
  3. $host = "localhost";
  4. $user = "root";
  5. $password = "";
  6. $database_name = "autocomplete";
  7. $pdo = new PDO("mysql:host=$host;dbname=$database_name", $user, $password, array(
  8. PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
  9. ));
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16. // OR author LIKE '%$search%' LIMIT 0 , 10
  17. $search=$_POST['studentnum'];
  18. $query = $pdo->prepare("select * from search, search_and_highlight where Name LIKE '%$search%'");
  19. $query->bindValue(1, "%$search%", PDO::PARAM_STR);
  20. $query->execute();
  21. // Display search result
  22. if (empty($search)) {
  23.  
  24. echo "<p>You forgot to enter a search term!!!";
  25.  
  26. } else
  27. if ( $results = $query->fetch()) {
  28.  
  29. echo ' <div class="tm-sidebar-pad-2">
  30. <a href="#" class="media tm-media tm-recommended-item">
  31. <img src="img/img-01.jpg" alt="Image">
  32. <div class="media-body tm-media-body tm-bg-gray">
  33. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">'.$results['Name'].'</h4>
  34. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">
  35. echo </h4>
  36. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">Kategorie</h4>
  37. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">. </h4>
  38. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">. </h4>
  39. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">Kategorie</h4>
  40. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">. </h4>
  41. <h4 class="text-uppercase tm-font-semibold tm-sidebar-item-title">Preis</h4>
  42. </div>
  43. </a>
  44.  
  45.  
  46. </div>';
  47.  
  48.  
  49.  
  50. } else {
  51. echo 'Nothing found';
  52. }
  53.  
  54. ?>
Add Comment
Please, Sign In to add comment