Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. $host="localhost"; // Host name
  4. $username="root"; // Mysql username
  5. $password=""; // Mysql password
  6. $db_name="test1"; // Database name
  7. $tbl_name="postjob"; // Table name
  8.  
  9. // Create connection
  10. $conn = new mysqli($host, $username, $password);
  11.  
  12. // Check connection
  13. if ($conn->connect_error) {
  14. die("Connection failed: " . $conn->connect_error);
  15. }
  16. echo "Connected successfully";
  17.  
  18. $dbconn = mysqli_select_db($conn, $db_name) or die(mysql_error());
  19. echo $dbconn;
  20. echo "Connected to Database<br />";
  21.  
  22. $output = '';
  23. $keywords=$_POST['keywords'];
  24. $location=$_POST['location'];
  25.  
  26. $keywords = mysqli_real_escape_string($conn, $keywords);
  27. $location = mysqli_real_escape_string($conn, $location);
  28.  
  29. $sql="SELECT * FROM $tbl_name WHERE job_title LIKE '%$keywords%' OR job_type
  30. LIKE '%$keywords%' OR job_category LIKE '%$keywords%' OR job_tags LIKE
  31. '%$keywords%' OR description LIKE '%$keywords%' OR company_name LIKE
  32. '%$keywords%' OR location LIKE'%$location%'";
  33. $result=mysqli_query($conn, $sql);
  34. $count=mysqli_num_rows($result);
  35. ?>
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  37. "http://www.w3.org/TR/html4/loose.dtd">
  38. <html>
  39. <head>
  40. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  41. <title>Sign Up</title>
  42. </head>
  43. <body>
  44. <section class="content_area">
  45. <div class="banner">
  46. <div class ="result">
  47. <table>
  48. <tr>
  49. <?php
  50. while($jobsearch=mysqli_fetch_assoc($result)) {
  51. echo "<tr>";
  52. echo "<td>"."<h3>".$jobsearch['job_title']."</h3>"."
  53. <br>".$jobsearch['company_name']."<br>".$jobsearch['description']."</td>";
  54. echo "</tr>";
  55. }
  56.  
  57. ?>
  58. </tr>
  59. </table>
  60. </div>
  61. </div>
  62. </section>
  63. </body>
  64. </html>
  65.  
  66. <?php
  67. while($jobsearch=mysqli_fetch_assoc($result)) {
  68. echo "<div>"."<h3>".$jobsearch['job_title']."</h3>"."
  69. <br>".$jobsearch['company_name']."<br>".$jobsearch['description'].
  70. </div>";
  71.  
  72. }
  73.  
  74. ?>
  75.  
  76. job_title
  77. company_name
  78. description
  79. <button>Apply</button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement