Guest User

Untitled

a guest
Apr 2nd, 2018
172
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. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "job_database";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error)
  11. {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14.  
  15. if(isset($_POST['Get']))
  16. {
  17. $jtitle = $_POST['jobtitle'];
  18. $location = $_POST['location'];
  19. $category = $_POST['categories'];
  20. //Query specified database for value
  21. $sql = "SELECT * FROM addjob where jtitle ='$jtitle' &and; location ='$location' &and; category ='$category' " ;
  22. $result = $conn->query($sql);
  23. }
  24.  
  25. if ($result->num_rows > 0) {
  26.  
  27. // output data of each row
  28. while($row = $result->fetch_assoc()) {
  29. echo "jtitle: " . $row["jtitle"]. "location:" . $row["location"]. "category" . $row["category"]."<br>";
  30. }
  31. } else {
  32. echo "0 results";
  33. }
  34.  
  35. $conn->close();
  36. ?>
Add Comment
Please, Sign In to add comment