-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
245 lines (214 loc) · 5.98 KB
/
Copy pathprocess.php
File metadata and controls
245 lines (214 loc) · 5.98 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?php
$conn = new mysqli('localhost', 'root', '', 'mace')
or die ('Cannot connect to db'); //connection establishment
header('Content-type: application/excel');
$filename = 'filename.xls';
header('Content-Disposition: attachment; filename='.$filename);
$ins1234=mysqli_query($conn,"INSERT INTO finalroom (No, room_name, capacity, status,occupy) SELECT No, room_name, capacity, status, occupy FROM `room21` ");
$query = mysqli_query($conn,"SELECT room_name,capacity,status FROM finalroom");
while($row= mysqli_fetch_array($query))
{
$inspector [] = $row['room_name'];
}
foreach ($inspector as $select1)
{
$select=$select1;
$qu1 = mysqli_query($conn,"SELECT capacity,status FROM finalroom where room_name='$select' ");
$row = mysqli_fetch_assoc($qu1);
$se=$row['capacity'];
$se1=$row['status'];
$last=$se;
if($select=='pg205')
{
$rows=7;
$cols=10;
}
elseif($select=='pg204')
{
$rows=6;
$cols=8;
} elseif($select=='pg107')
{
$rows=7;
$cols=10;
} elseif($select=='pg206')
{
$rows=9;
$cols=8;
} elseif($select=='pg208')
{
$rows=6;
$cols=10;
} elseif($select=='pg307')
{
$rows=6;
$cols=12;
} elseif($select=='mpv311')
{
$rows=12;
$cols=5;
} elseif($select=='f401')
{
$rows=20;
$cols=7;
} elseif($select=='mpv201')
{
$rows=9;
$cols=6;
} elseif($select=='pg308')
{
$rows=7;
$cols=10;
} elseif($select=='pg309')
{
$rows=6;
$cols=12;
} elseif($select=='pg312')
{
$rows=7;
$cols=9;
} elseif($select=='l110')
{
$rows=6;
$cols=8;
} elseif($select=='l217')
{
$rows=6;
$cols=8;
} elseif($select=='l218')
{
$rows=6;
$cols=8;
} elseif($select=='l109')
{
$rows=7;
$cols=10;
} elseif($select=='l02')
{
$rows=6;
$cols=8;
} elseif($select=='l04')
{
$rows=6;
$cols=8;
} elseif($select=='l07')
{
$rows=8;
$cols=6;
} elseif($select=='l08')
{
$rows=6;
$cols=8;
} elseif($select=='l201')
{
$rows=7;
$cols=6;
} elseif($select=='m12')
{
$rows=8;
$cols=10;
} elseif($select=='m13')
{
$rows=9;
$cols=8;
}
elseif($select=='m15')
{
$rows=6;
$cols=8;
}
$qu1 = mysqli_query($conn,"SELECT * FROM finalroom where room_name='$select' ");
$row = mysqli_fetch_assoc($qu1);
$se=$row['capacity'];
$se1=$row['status'];
if($se1==2)
{
$s=$se/2;
unset($inspector1);
unset($inspector2);
$coun1 = mysqli_num_rows(mysqli_query($conn, "SELECT * FROM $select"));
$ins123=mysqli_query($conn,"INSERT INTO temp1 (Reg_no,Course) SELECT Reg_no,Course FROM $select LIMIT $s");
$dels=mysqli_query($conn, "DELETE FROM $select LIMIT $s");
$ins12=mysqli_query($conn,"INSERT INTO temp2 (Reg_no,Course) SELECT Reg_no,Course FROM $select LIMIT $s");
$dels1=mysqli_query($conn, "DELETE FROM $select LIMIT $s");
echo $se;
$i=0;
$r=$coun1/2;
$j=0;
$k=1;
$qi1 = mysqli_query($conn,"SELECT Reg_no FROM temp1 ");
while($row = mysqli_fetch_array($qi1))
{
$inspector1 [] = $row['Reg_no'];
}
$qi21 = mysqli_query($conn,"SELECT Reg_no FROM temp2 ");
while($row = mysqli_fetch_array($qi21))
{
$inspector2 [] = $row['Reg_no'];
}
echo "<table border='1'>";
echo '<tr>';
echo" <td align=center colspan=$cols >Mar Athanasius College of Engineering, Kothamangalam</td>";
echo"</tr>";
echo"<tr>";
echo" <td align=center colspan=$cols >Exam Hall Details for the conduct of KTU University examination </td>";
echo"</tr>";
echo "<tr>";
echo"<td >Room No</td>";
echo"<td >$select</td>";
echo"<td colspan=2 >Date</td>";
echo"<td colspan=3 ></td>";
echo"<td colspan=3 >Total Students</td>";
echo" </tr>";
//echo "</table>";
//echo "<table border='1'>";
for($tr=0;$tr<$rows;$tr++){
echo "<tr>";
echo "<td>DESK $k</td>";
$k++;
for($td=0;$td<$cols/2;$td++){
echo "<td > $inspector1[$i] </td>";
$i++;
echo "<td > $inspector2[$j]</td>";
$j++;
}
echo "</tr>";
}
$ins123=mysqli_query($conn,"INSERT INTO $select (Reg_no,Course) SELECT Reg_no,Course FROM temp1 LIMIT $s");
$dels=mysqli_query($conn, "DELETE FROM temp1 LIMIT $s");
$ins12=mysqli_query($conn,"INSERT INTO $select (Reg_no,Course) SELECT Reg_no,Course FROM temp2 LIMIT $s");
$dels1=mysqli_query($conn, "DELETE FROM temp2 LIMIT $s");
echo "</table>";
for($o=0;$o<=10;$o++)
{
echo "<br/><br/>";
}
}
else {
$i=0;
$qi1 = mysqli_query($conn,"SELECT Reg_no FROM $select ");
unset($inspector1);
while($row = mysqli_fetch_array($qi1))
{
$inspector1 [] = $row['Reg_no'];
$inspector2 [] = $row['Reg_no'];
}
echo "<table border='1'>";
for($tr=0;$tr<$rows;$tr++){
echo "<tr>";
for($td=0;$td<$cols;$td++){
echo "<td> $inspector1[$i]</td>";
$i++;
}
echo "</tr>";
}
echo "</table>";
for($o=0;$o<=10;$o++)
{
echo "<br/><br/>";
}
}
}
$qw= mysqli_query($conn,"DELETE FROM finalroom")
//for ($i = 0; $i < count($inspector1); $i++) { unset($inspector1[$i]); }
?>