Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. $host = 'localhost';
  2. $user = '111042';
  3. $password = 'jcbvrjd8';
  4. $db_name = '111042';
  5. $search = $_POST["search"];
  6. if(isset($search)) {
  7. $db = mysqli_connect($host, $user, $password, $db_name);
  8. $wild_search = "%".$search."%";
  9. $findname = "SELECT `name`,`surname`
  10. FROM `Account`
  11. WHERE `name` LIKE '".$wild_search."'
  12. OR `surname` LIKE '".$wild_search."'
  13. OR CONCAT(`name`, `surname`) LIKE '".$wild_search."'
  14. OR CONCAT(`name`, `surnameprefix`, `surname`) LIKE '".$wild_search."';";
  15. $query = mysqli_query($db,$findname);
  16. $results = mysqli_fetch_all($query);
  17.  
  18. if($result) {
  19. echo "<div id='searchresult'>n";
  20. echo "<h1>People Found:</h1>n";
  21. echo "<table id='searchresult'>n";
  22. foreach($result as $rowno => $row) {
  23. echo "<tr class='searchtablerow'>n";
  24. echo "<td>".$row['name'].", ".$row['surname']."</td>n";
  25. echo "</tr>n";
  26. }
  27. echo "</table>n";
  28. } else {
  29. echo "<div id='searchresult'><h1>People Found:</h1>n";
  30. echo "<p>No one was found...</p>n";
  31. echo "</div>n";
  32. }
  33. } else {
  34. }
  35.  
  36. <div id="searchform">
  37. <h1>Search friends:</h1>
  38. <form name="searchform" method="post" action ="searchlink.php">
  39. <input type="text" name="search" id="search" autofocus placeholder="e.g. John Smith..."></input> <br>
  40. <input type="submit" name="submitsearch" value="Search" id="searchbutton"></input>
  41. </form>
  42. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement