SHOW:
|
|
- or go back to the newest paste.
1 | - | <div class="modal-header"> |
1 | + | <?php |
2 | - | <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> |
2 | + | /* |
3 | logika yang saya gunakan adalah join | |
4 | pada codingnya saya pisah2 data utamanya ke array $rawData yang nanti di baca2 dengan foreach atau for sesuai cocok/tidaknya coding yang digunakan | |
5 | */ | |
6 | - | |
6 | + | $mysqli=new mysqli("localhost","root2","musthofa","test_guru"); |
7 | if(!isset($_GET['nip'])){ | |
8 | - | <?php |
8 | + | $sql="select nip from tb_dosen order by rand() limit 1"; |
9 | - | $id = $_GET['nip']; |
9 | + | $result = $mysqli->query($sql); |
10 | - | $qry=" |
10 | + | $row = $result->fetch_array(MYSQLI_ASSOC); |
11 | - | select |
11 | + | header("location:?nip=".$row['nip']); |
12 | - | tb_dosen.nip, tb_dosen.nidn_nidk, tb_dosen.nama, tb_dosen.jenis_kelamin, tb_dosen.alamat, tb_dosen.telepon, tb_dosen.agama, tb_dosen.pendidikan_terakhir, tb_dosen.jabatan, tb_dosen.email, tb_dosen.foto, |
12 | + | exit(); |
13 | - | tb_bimbingan.no_bimbingan, tb_bimbingan.nip, tb_bimbingan.tahun_bimbingan, tb_bimbingan.nama_mahasiswa,tb_bimbingan.judul, |
13 | + | } |
14 | - | tb_pendidikan.no_pendidikan, tb_pendidikan.nip, tb_pendidikan.tahun_lulus, tb_pendidikan.jenjang, tb_pendidikan.gelar, tb_pendidikan.nama_universitas, tb_pendidikan.bidang_ilmu, tb_pendidikan.no_ijasah, |
14 | + | else{ |
15 | - | tb_buku.no_buku, tb_buku.nip, tb_buku.penulis, tb_buku.judul_buku, tb_buku.penerbit_buku, tb_buku.tahun_terbit, |
15 | + | $rawData=array(); |
16 | - | tb_jabatan_ak.no_jabatan, tb_jabatan_ak.nip, tb_jabatan_ak.tahun_diangkat, tb_jabatan_ak.posisi, tb_jabatan_ak.no_sk, |
16 | + | $nip=$_GET['nip']; |
17 | - | tb_jafung.no_jafung, tb_jafung.nip, tb_jafung.tahun_jafung, tb_jafung.jafung, tb_jafung.sk_jafung, tb_jafung.sk_sertifikasi, |
17 | + | $sql="select * from tb_dosen"; |
18 | - | tb_penelitian.no_penelitian, tb_penelitian.nip, tb_penelitian.tahun_penelitian, tb_penelitian.judul_penelitian, tb_penelitian.tempat_publikasi, |
18 | + | $rawData['dosen'] = $mysqli->query($sql)->fetch_array(MYSQLI_ASSOC); |
19 | - | tb_pengajaran.no_pengajaran, tb_pengajaran.nip, tb_pengajaran.tahun_akademik, tb_pengajaran.semester, tb_pengajaran.mata_kuliah, tb_pengajaran.sk_mengajar, |
19 | + | $aTable=array( |
20 | - | tb_penghargaan.no_penghargaan, tb_penghargaan.nip, tb_penghargaan.tanggal_penghargaan, tb_penghargaan.jenis_penghargaan, tb_penghargaan.pemberi, |
20 | + | 'bimbingan'=>'bimbingan', |
21 | - | tb_pkm.no_pkm, tb_pkm.nip, tb_pkm.tahun_pkm, tb_pkm.judul_pkm, tb_pkm.tempat_pkm, tb_pkm.publikasi_pkm, |
21 | + | 'buku'=>'buku', |
22 | - | tb_seminar.no_seminar, tb_seminar.nip, tb_seminar.judul_seminar, tb_seminar.sebagai, tb_seminar.jenis_seminar, tb_seminar.kota, tb_seminar.tanggal_seminar |
22 | + | 'jabatan'=>'jabatan_ak', |
23 | - | from tb_dosen |
23 | + | 'jabatan_fungsional'=>'jafung', |
24 | - | INNER JOIN tb_bimbingan ON tb_bimbingan.nip = tb_dosen.nip |
24 | + | 'pendidikan'=>'pendidikan', |
25 | - | INNER JOIN tb_pendidikan ON tb_pendidikan.nip = tb_dosen.nip |
25 | + | 'penelitian'=>'penelitian', |
26 | - | INNER JOIN tb_buku ON tb_buku.nip = tb_dosen.nip |
26 | + | 'pengajaran'=>'pengajaran', |
27 | - | INNER JOIN tb_jabatan_ak ON tb_jabatan_ak.nip = tb_dosen.nip |
27 | + | 'penghargaan'=>'penghargaan', |
28 | - | INNER JOIN tb_jafung ON tb_jafung.nip = tb_dosen.nip |
28 | + | 'pkm'=>'pkm', |
29 | - | INNER JOIN tb_penelitian ON tb_penelitian.nip = tb_dosen.nip |
29 | + | 'seminar'=>'seminar' |
30 | - | INNER JOIN tb_pengajaran ON tb_pengajaran.nip = tb_dosen.nip |
30 | + | |
31 | - | INNER JOIN tb_penghargaan ON tb_penghargaan.nip = tb_dosen.nip |
31 | + | ); |
32 | - | INNER JOIN tb_pkm ON tb_pkm.nip = tb_dosen.nip |
32 | + | foreach($aTable as $name=>$table){ |
33 | - | INNER JOIN tb_seminar ON tb_seminar.nip = tb_dosen.nip |
33 | + | $rawData[$name]=fetchTableKuliah('tb_'.$table,$nip); |
34 | - | where tb_dosen.nip = $id |
34 | + | } |
35 | - | order by no_pendidikan |
35 | + | // echo '<pre>';print_r($data);die(); |
36 | - | "; |
36 | + | } |
37 | - | $hasil=mysql_query($qry) or die ("".mysql_error()); |
37 | + | ?><div class="modal-header"> |
38 | - | //$row = mysql_num_rows($hasil) or die ("".mysql_error()); |
38 | + | <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> |
39 | - | $data=mysql_fetch_array($hasil) or die ("".mysql_error()); |
39 | + | |
40 | - | |
40 | + | |
41 | - | |
41 | + | |
42 | - | ?> |
42 | + | |
43 | - | <div class="col-lg-12"> |
43 | + | |
44 | - | <div class="row"> |
44 | + | <div class="col-lg-12"> |
45 | - | <div class="col-lg-4"> |
45 | + | <div class="row"> |
46 | - | <table class="table table-condensed"> |
46 | + | <div class="col-lg-4"> |
47 | <?php $data=$rawData['dosen'];?> | |
48 | - | <td><label>N.I.P</label></td> |
48 | + | <table class="table table-condensed"> |
49 | - | <td><?php echo $data['nip']; ?></td> |
49 | + | |
50 | - | </tr> |
50 | + | <td><label>N.I.P</label></td> |
51 | - | <tr> |
51 | + | <td><?php echo $data['nip']; ?></td> |
52 | </tr> | |
53 | <tr> | |
54 | - | </tr> |
54 | + | |
55 | - | <tr> |
55 | + | |
56 | </tr> | |
57 | <tr> | |
58 | - | </tr> |
58 | + | |
59 | - | <tr> |
59 | + | |
60 | </tr> | |
61 | <tr> | |
62 | - | </tr> |
62 | + | |
63 | - | <tr> |
63 | + | |
64 | </tr> | |
65 | <tr> | |
66 | - | </tr> |
66 | + | |
67 | - | <tr> |
67 | + | |
68 | </tr> | |
69 | <tr> | |
70 | - | </tr> |
70 | + | |
71 | - | <tr> |
71 | + | |
72 | </tr> | |
73 | <tr> | |
74 | - | </tr> |
74 | + | |
75 | - | <tr> |
75 | + | |
76 | </tr> | |
77 | <tr> | |
78 | - | </tr> |
78 | + | |
79 | - | <tr> |
79 | + | |
80 | - | <td><label>Telepon</label></td> |
80 | + | </tr> |
81 | - | <td><?php echo $data['telepon']; ?></td> |
81 | + | |
82 | - | </tr> |
82 | + | <td><label>Telepon</label></td> |
83 | - | <tr> |
83 | + | <td><?php echo $data['telepon']; ?></td> |
84 | - | <td><label>Email</label></td> |
84 | + | </tr> |
85 | - | <td><?php echo $data['email']; ?></td> |
85 | + | |
86 | - | </tr> |
86 | + | <td><label>Email</label></td> |
87 | - | </table> |
87 | + | <td><?php echo $data['email']; ?></td> |
88 | </tr> | |
89 | </table> | |
90 | </div> | |
91 | <div class="col-lg-2"> | |
92 | <?php echo "<img src='administrasi/foto/".$data['foto']."' width='195px' height='195px'>"; ?> | |
93 | - | <!--<div class="panel panel-primary panel-heading">ddd</div>--> |
93 | + | |
94 | <div class="col-lg-6"> | |
95 | - | <li class="active"><a data-toggle="tab" href="#pendidikan">Pendidikan</a></li> |
95 | + | <!--<div class="panel panel-primary panel-heading">ddd</div>--> |
96 | <ul class="nav nav-tabs"> | |
97 | <li class="active"><a data-toggle="tab" href="#pendidikan">Pendidikan</a></li> | |
98 | <li><a data-toggle="tab" href="#buku">Buku</a></li> | |
99 | <li><a data-toggle="tab" href="#bimbingan">Bimbingan</a></li> | |
100 | <li><a data-toggle="tab" href="#akademik">Jab. Akademik</a></li> | |
101 | <li><a data-toggle="tab" href="#fungsional">Jab. Fungsional</a></li> | |
102 | <li><a data-toggle="tab" href="#penelitian">Penelitian</a></li> | |
103 | <li><a data-toggle="tab" href="#pengajaran">Pengajaran</a></li> | |
104 | <li><a data-toggle="tab" href="#penghargaan">Penghargaan</a></li> | |
105 | <li><a data-toggle="tab" href="#pkm">PKM</a></li> | |
106 | <li><a data-toggle="tab" href="#seminar">Seminar</a></li> | |
107 | - | <div id="pendidikan" class="tab-pane fade in active"> |
107 | + | |
108 | - | <table class="table table-condensed"> |
108 | + | |
109 | <div id="pendidikan" class="tab-pane fade in active"> | |
110 | - | <th>No.</th> |
110 | + | <table class="table table-condensed"> |
111 | <tr> | |
112 | <th>No.</th> | |
113 | <th>Tahun Lulus</th> | |
114 | <th>Jenjang</th> | |
115 | <th>Gelar</th> | |
116 | <th>Nama Universitas</th> | |
117 | <th>Bidang Ilmu</th> | |
118 | - | <?php while ($l=mysql_fetch_array($hasil)) |
118 | + | |
119 | - | { |
119 | + | |
120 | - | //menamiplkan record pendidikan |
120 | + | <?php |
121 | //while ($l=mysql_fetch_array($hasil)){ | |
122 | //menamiplkan record pendidikan | |
123 | - | <td><?php echo $l['no_pendidikan']; ?></td> |
123 | + | foreach($rawData['pendidikan'] as $data){ |
124 | - | <td><?php echo $l['tahun_lulus']; ?></td> |
124 | + | ?> |
125 | - | <td><?php echo $l['jenjang']; ?></td> |
125 | + | |
126 | - | <td><?php echo $l['gelar']; ?></td> |
126 | + | <td><?php echo $data['no_pendidikan']; ?></td> |
127 | - | <td><?php echo $l['nama_universitas']; ?></td> |
127 | + | <td><?php echo $data['tahun_lulus']; ?></td> |
128 | - | <td><?php echo $l['bidang_ilmu']; ?></td> |
128 | + | <td><?php echo $data['jenjang']; ?></td> |
129 | - | <td><?php echo $l['no_ijasah']; ?></td> |
129 | + | <td><?php echo $data['gelar']; ?></td> |
130 | <td><?php echo $data['nama_universitas']; ?></td> | |
131 | <td><?php echo $data['bidang_ilmu']; ?></td> | |
132 | <td><?php echo $data['no_ijasah']; ?></td> | |
133 | </tr> | |
134 | - | |
134 | + | |
135 | </table> | |
136 | - | <table class="table table-condensed"> |
136 | + | |
137 | - | <tr> |
137 | + | |
138 | - | <th>No.</th> |
138 | + | |
139 | <table class="table table-condensed"> | |
140 | <tr> | |
141 | <th>No.</th> | |
142 | <th>Penulis</th> | |
143 | <th>Judul Buku</th> | |
144 | <th>Tahun Terbit</th> | |
145 | - | <td><?php echo $data['no_buku']; ?></td> |
145 | + | |
146 | </tr> | |
147 | <?php | |
148 | foreach($rawData['buku'] as $data){ | |
149 | ?> | |
150 | <tr> | |
151 | <td><?php echo $data['no_buku']; ?></td> | |
152 | <td><?php echo $data['penulis']; ?></td> | |
153 | <td><?php echo $data['judul_buku']; ?></td> | |
154 | - | <table class="table table-condensed"> |
154 | + | |
155 | - | <tr> |
155 | + | |
156 | - | <th>No. Bimbingan</th> |
156 | + | |
157 | <?php | |
158 | } | |
159 | ?> | |
160 | </table> | |
161 | </div> | |
162 | - | <td><?php echo $data['no_bimbingan']; ?></td> |
162 | + | |
163 | <table class="table table-condensed"> | |
164 | <tr> | |
165 | <th>No. Bimbingan</th> | |
166 | <th>Tahun Bimbingan</th> | |
167 | <th>Nama Mahasiswa</th> | |
168 | <th>Judul</th> | |
169 | </tr> | |
170 | - | <table class="table table-condensed"> |
170 | + | <?php |
171 | - | <tr> |
171 | + | foreach($rawData['bimbingan'] as $data){ |
172 | - | <th>No.</th> |
172 | + | ?> |
173 | <tr> | |
174 | <td><?php echo $data['no_bimbingan']; ?></td> | |
175 | <td><?php echo $data['tahun_bimbingan']; ?></td> | |
176 | <td><?php echo $data['nama_mahasiswa']; ?></td> | |
177 | <td><?php echo $data['judul']; ?></td> | |
178 | - | <td><?php echo $data['no_jabatan']; ?></td> |
178 | + | |
179 | <?php | |
180 | } | |
181 | ?> | |
182 | </table> | |
183 | </div> | |
184 | <div id="akademik" class="tab-pane fade"> | |
185 | - | <table class="table table-condensed"> |
185 | + | <table class="table table-condensed"> |
186 | - | <tr> |
186 | + | |
187 | - | <th>No.</th> |
187 | + | <th>No.</th> |
188 | <th>Tahun Diangkat</th> | |
189 | <th>Posisi</th> | |
190 | <th>No. SK</th> | |
191 | </tr> | |
192 | <?php | |
193 | foreach($rawData['jabatan'] as $data){ | |
194 | - | <td><?php echo $data['no_jafung']; ?></td> |
194 | + | ?> |
195 | <tr> | |
196 | <td><?php echo $data['no_jabatan']; ?></td> | |
197 | <td><?php echo $data['tahun_diangkat']; ?></td> | |
198 | <td><?php echo $data['posisi']; ?></td> | |
199 | <td><?php echo $data['no_sk']; ?></td> | |
200 | </tr> | |
201 | <?php | |
202 | } | |
203 | - | <table class="table table-condensed"> |
203 | + | |
204 | - | <tr> |
204 | + | |
205 | - | <th>No.</th> |
205 | + | |
206 | <div id="fungsional" class="tab-pane fade"> | |
207 | <table class="table table-condensed"> | |
208 | <tr> | |
209 | <th>No.</th> | |
210 | <th>Tahun Jabatan Fungsional</th> | |
211 | - | <td><?php echo $data['no_penelitian']; ?></td> |
211 | + | |
212 | <th>SK Jabatan Fungsional</th> | |
213 | <th>SK Sertifikasi</th> | |
214 | </tr> | |
215 | <?php | |
216 | foreach($rawData['jabatan_fungsional'] as $data){ | |
217 | ?> | |
218 | <tr> | |
219 | - | <table class="table table-condensed"> |
219 | + | <td><?php echo $data['no_jafung']; ?></td> |
220 | - | <tr> |
220 | + | |
221 | - | <th>No.</th> |
221 | + | |
222 | <td><?php echo $data['sk_jafung']; ?></td> | |
223 | <td><?php echo $data['sk_sertifikasi']; ?></td> | |
224 | </tr> | |
225 | <?php | |
226 | } | |
227 | - | <td><?php echo $data['no_pengajaran']; ?></td> |
227 | + | |
228 | </table> | |
229 | </div> | |
230 | <div id="penelitian" class="tab-pane fade"> | |
231 | <table class="table table-condensed"> | |
232 | <tr> | |
233 | <th>No.</th> | |
234 | <th>Tahun Penelitian</th> | |
235 | <th>Judul Penelitian</th> | |
236 | - | <table class="table table-condensed"> |
236 | + | |
237 | - | <tr> |
237 | + | |
238 | - | <th>No.</th> |
238 | + | <?php |
239 | foreach($rawData['penelitian'] as $data){ | |
240 | ?> | |
241 | <tr> | |
242 | <td><?php echo $data['no_penelitian']; ?></td> | |
243 | <td><?php echo $data['tahun_penelitian']; ?></td> | |
244 | - | <td><?php echo $data['no_penghargaan']; ?></td> |
244 | + | |
245 | <td><?php echo $data['tempat_publikasi']; ?></td> | |
246 | </tr> | |
247 | <?php | |
248 | } | |
249 | ?> | |
250 | </table> | |
251 | </div> | |
252 | <div id="pengajaran" class="tab-pane fade"> | |
253 | - | <tr> |
253 | + | <table class="table table-condensed"> |
254 | - | <th>No.</th> |
254 | + | |
255 | - | <th>Tahun PKM/th> |
255 | + | <th>No.</th> |
256 | <th>Tahun Akademik</th> | |
257 | <th>Semester</th> | |
258 | <th>Mata Kuliah</th> | |
259 | <th>SK Mengajar</th> | |
260 | </tr> | |
261 | - | <td><?php echo $data['no_pkm']; ?></td> |
261 | + | <?php |
262 | foreach($rawData['pengajaran'] as $data){ | |
263 | ?> | |
264 | <tr> | |
265 | <td><?php echo $data['no_pengajaran']; ?></td> | |
266 | <td><?php echo $data['tahun_akademik']; ?></td> | |
267 | <td><?php echo $data['semester']; ?></td> | |
268 | <td><?php echo $data['mata_kuliah']; ?></td> | |
269 | <td><?php echo $data['sk_mengajar']; ?></td> | |
270 | - | <table class="table table-condensed"> |
270 | + | |
271 | - | <tr> |
271 | + | <?php |
272 | - | <th>No.</th> |
272 | + | } |
273 | ?> | |
274 | </table> | |
275 | </div> | |
276 | <div id="penghargaan" class="tab-pane fade"> | |
277 | <table class="table table-condensed"> | |
278 | <tr> | |
279 | <th>No.</th> | |
280 | - | <td><?php echo $data['no_seminar']; ?></td> |
280 | + | |
281 | <th>Jenis Penghargaan</th> | |
282 | <th>Pemberi</th> | |
283 | </tr> | |
284 | <?php | |
285 | foreach($rawData['penghargaan'] as $data){ | |
286 | ?> | |
287 | <tr> | |
288 | <td><?php echo $data['no_penghargaan']; ?></td> | |
289 | <td><?php echo $data['tanggal_penghargaan']; ?></td> | |
290 | <td><?php echo $data['jenis_penghargaan']; ?></td> | |
291 | <td><?php echo $data['pemberi']; ?></td> | |
292 | </tr> | |
293 | - | |
293 | + | <?php |
294 | - | </div> |
294 | + | } |
295 | ?> | |
296 | </table> | |
297 | </div> | |
298 | <div id="pkm" class="tab-pane fade"> | |
299 | <table class="table table-condensed"> | |
300 | <tr> | |
301 | <th>No.</th> | |
302 | <th>Tahun PKM</th> | |
303 | <th>Tempat PKM</th> | |
304 | <th>Judul PKM</th> | |
305 | <th>Publikasi PKM</th> | |
306 | </tr> | |
307 | <?php | |
308 | foreach($rawData['pkm'] as $data){ | |
309 | ?> | |
310 | <tr> | |
311 | <td><?php echo $data['no_pkm']; ?></td> | |
312 | <td><?php echo $data['tahun_pkm']; ?></td> | |
313 | <td><?php echo $data['tempat_pkm']; ?></td> | |
314 | <td><?php echo $data['judul_pkm']; ?></td> | |
315 | <td><?php echo $data['publikasi_pkm']; ?></td> | |
316 | </tr> | |
317 | <?php | |
318 | } | |
319 | ?> | |
320 | </table> | |
321 | </div> | |
322 | <div id="seminar" class="tab-pane fade"> | |
323 | <table class="table table-condensed"> | |
324 | <tr> | |
325 | <th>No.</th> | |
326 | <th>Tanggal Seminar</th> | |
327 | <th>Judul Seminar</th> | |
328 | <th>Sebagai</th> | |
329 | <th>Jenis Seminar</th> | |
330 | <th>Kota</th> | |
331 | </tr> | |
332 | <?php | |
333 | foreach($rawData['seminar'] as $data){ | |
334 | ?> | |
335 | <tr> | |
336 | <td><?php echo $data['no_seminar']; ?></td> | |
337 | <td><?php echo $data['tanggal_seminar']; ?></td> | |
338 | <td><?php echo $data['judul_seminar']; ?></td> | |
339 | <td><?php echo $data['sebagai']; ?></td> | |
340 | <td><?php echo $data['jenis_seminar']; ?></td> | |
341 | <td><?php echo $data['kota']; ?></td> | |
342 | </tr> | |
343 | <?php | |
344 | } | |
345 | ?> | |
346 | </table> | |
347 | </div> | |
348 | </div> | |
349 | </div> | |
350 | </div> | |
351 | </div> | |
352 | ||
353 | </div> | |
354 | <?php | |
355 | function fetchTableKuliah($table, $nip){ | |
356 | global $mysqli; | |
357 | $sql="select * from {$table} where nip like '{$nip}'"; | |
358 | if(!$result = $mysqli->query($sql)){ | |
359 | $err=sprintf("Errormessage: %s\n", $mysqli->error); | |
360 | return $err; | |
361 | } | |
362 | else{ | |
363 | while($row = $result->fetch_array(MYSQLI_ASSOC)){ | |
364 | $raw[]=$row; | |
365 | } | |
366 | return $raw; | |
367 | } | |
368 | return false; | |
369 | } | |
370 | ||
371 | ?> |