Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title> Wesco Search </title>
  6. </head>
  7.  
  8. <body>
  9. <form action="search.php" method="POST">
  10. <input type="text" name="searchterm" placeholder="Search..."><br />
  11. <input type="submit" value="Search">
  12. </form>
  13. </body>
  14. </html>
  15.  
  16. <!doctype html>
  17. <html>
  18. <head>
  19. <meta charset="utf-8">
  20. <title>Part Search</title>
  21. </head>
  22. <body>
  23. <?php
  24. $username = "xxxxx";
  25. $password = "xxxxx";
  26. $hostname = "localhost";
  27.  
  28. //connection to the database
  29. mysql_connect($hostname, $username, $password);
  30. mysql_select_db("wesco");
  31.  
  32. $search = mysql_real_escape_string(trim($_POST['searchterm']));
  33.  
  34. $find_parts = mysql_query("SELECT * FROM 'parts' WHERE 'keywords' LIKE'%$search%'");
  35.  
  36. while($row = mysql_fetch_assoc($find_parts))
  37. {
  38. $name = $row['name'];
  39. echo "$name<br />";
  40.  
  41. }
  42.  
  43. ?>
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement