-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob_major.php
81 lines (59 loc) · 1.55 KB
/
job_major.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
session_start();
?>
<!--if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){-->
<!-- header("location: login.php");-->
<!-- exit;-->
<!--}-->
<!DOCTYPE html>
<html lang="en">
<head
</head>
<body>
<div class="intro-header">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-message">
<h1 id="hdrDescription">Hola</h1>
<p></p>
<p></p>
<p><span style="color:#AFEEEE;"><span style="font-size:22px;">All you care is getting a job.</span></span></p>
<p></p>
<p></p>
<?php
$db_host = "Localhost";
$db_username = "teammmproject_a";
$db_password = "teammmproject_a";
$db_name = "teammmproject_jobs";
$mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
$q = $_POST['major'];
if ($q == "CS") {
$sql = "SELECT studentID FROM Education WHERE major = '$q';";
}
else if ($q == "IE") {
$sql = "SELECT DISTINCT job FROM Students NATURAL JOIN Education WHERE major = '$q';";
}
else if ($q == "ME") {
$sql = "SELECT DISTINCT job FROM Students NATURAL JOIN Education WHERE major = '$q';";
}
$result = $mysqli->query($sql);
if (mysqli_num_rows($result)) {
// header('Location: ../job_major.php');
// exit();
while($row = $result->fetch_assoc()){
echo("CS: " . $row["studentID"]. "<br/>");
}
}
else {
echo("0 result");
}
$mysqli->close();
?>
</div>
</div>
</div>
</div>
<!-- /.container --></div>
<!-- /.intro-header --><!-- jQuery --><script src="js/jquery.js"></script><!-- Bootstrap Core JavaScript --><script src="js/bootstrap.min.js"></script></body>
</html>