-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompany2.php
171 lines (158 loc) · 4.81 KB
/
company2.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Company Information Page</title>
<link rel="stylesheet" type="text/css" href="style6.css">
</head>
<body>
<h1>COMPANY   DETAILS</h1>
<br><br>
<h3>The Company details you opted for your chosen Game is displayed below :</h3>
<?php
$conn = mysqli_connect("localhost", "root", "", "gameplanet");
if ($conn-> connect_error) {
die("Connection failed:". $conn-> connect_error);
}
$id = $_POST['gameid'];
$info = $_POST['companyinfo'];
if ($info == "companyname"){
echo "<table>
<tr>
<th>Company name</th>
</tr>";
$sql = "Select cname from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["cname"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else if ($info == "composer"){
echo "<table>
<tr>
<th>Composer(s)</th>
</tr>";
$sql = "Select composer from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["composer"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else if ($info == "artist"){
echo "<table>
<tr>
<th>Artist(s)</th>
</tr>";
$sql = "Select artist from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["artist"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else if ($info == "writer"){
echo "<table>
<tr>
<th>Writer(s)</th>
</tr>";
$sql = "Select writer from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["writer"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else if ($info == "programmer"){
echo "<table>
<tr>
<th>Programmer(s)</th>
</tr>";
$sql = "Select programmer from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["programmer"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else if ($info == "developer"){
echo "<table>
<tr>
<th>Developer(s)</th>
</tr>";
$sql = "Select developer from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["developer"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else if ($info == "engine"){
echo "<table>
<tr>
<th>Engine</th>
</tr>";
$sql = "Select engine from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["engine"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
else {
echo "<table>
<tr>
<th>Director(s)</th>
</tr>";
$sql = "Select director from company where gid = '$id'";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["director"] ."</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
}
$conn-> close();
?>
</body>
</html>