Tolong pilih kategori sesuai, jenis posting (diskusi atau bukan) dan sertakan tag/topik yang sesuai seperti komputer, java, php, mysql, dll. Promosi atau posting tidak pada tempatnya akan kami hapus!
- Bagi Anda yang ingin mendaftar, baca link berikut:
http://diskusiweb.com/discussion/50491/how-to-registrasi-diskusiweb-com-baca-ini-terlebih-dahulu
- Cara menyisipkan kode program supaya tampil rapi dan terformat dengan baik di diskusiweb.com: http://www.diskusiweb.com/discussion/50415/cara-menyisipkan-kode-program-di-diskusiweb-com
- Cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

Filter Data dengan Checkbox dan Join php mysqli

Logicnya masih bingung nih buat nampilin data yang sesuai checkbox. kalau checkboxnya udah bisa jalan field Active juga berfungsi. Tapi buat nampilinnya masih bingung karena ada tabel join

<?PHP include_once("../connection.php"); ?> <div class="container"> <thead> <?php $get_active_defect = mysqli_query($mysqli,"SELECT * FROM t_defect_class"); //$get_active_defect = mysqli_query($mysqli,"SELECT * FROM t_defect_class WHERE ACTIVE='1'"); $loop = 1; while($rows = mysqli_fetch_array($get_active_defect)) { echo '<th class="text-center" >'.$rows['DEFECT_CLASS_NAME'].'</th>'; if($loop == 5 || $loop == 10 || $loop == 15){ } $loop++; } ?> </thead> <?php //menampilkan data mysqli $no = 0; $modal=mysqli_query($konek," SELECT t_name_file.PROCESS_TIME, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 1 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `1`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 2 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `2`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 3 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `3`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 4 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `4`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 5 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `5`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 6 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `6`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 7 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `7`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 8 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `8`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 9 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `9`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 10 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `10`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 11 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `11`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 12 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `12`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 13 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `13`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 14 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `14`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 15 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `15`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 16 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `16`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 17 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `17`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 18 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `18`, COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 19 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `19` FROM t_transaction INNER JOIN t_name_file ON t_transaction.NAMEFILE_ID=t_name_file.NAMEFILE_ID INNER JOIN t_defect_class ON t_transaction.DEFECT_CLASS_ID=t_defect_class.DEFECT_CLASS_ID GROUP BY t_transaction.DEFECT_CLASS_ID, t_name_file.PROCESS_TIME ORDER BY t_name_file.PROCESS_TIME"); while($defect=mysqli_fetch_array($modal)){ $no++; ?> <tbody> <tr> <td class="text-center"><?php echo $defect['PROCESS_TIME']; ?></td> <td class="text-center"><?php echo $defect['1']; ?></td> <td class="text-center"><?php echo $defect['2']; ?></td> <td class="text-center"><?php echo $defect['3']; ?></td> <td class="text-center"><?php echo $defect['4']; ?></td> <td class="text-center"><?php echo $defect['5']; ?></td> <td class="text-center"><?php echo $defect['6']; ?></td> <td class="text-center"><?php echo $defect['7']; ?></td> <td class="text-center"><?php echo $defect['8']; ?></td> <td class="text-center"><?php echo $defect['9']; ?></td> <td class="text-center"><?php echo $defect['10']; ?></td> <td class="text-center"><?php echo $defect['11']; ?></td> <td class="text-center"><?php echo $defect['12']; ?></td> <td class="text-center"><?php echo $defect['13']; ?></td> <td class="text-center"><?php echo $defect['14']; ?></td> <td class="text-center"><?php echo $defect['15']; ?></td> <td class="text-center"><?php echo $defect['16']; ?></td> <td class="text-center"><?php echo $defect['17']; ?></td> <td class="text-center"><?php echo $defect['18']; ?></td> <td class="text-center"><?php echo $defect['19']; ?></td> <!--<td class="text-center"><?php echo "<a href='#myModal' class='btn btn-success btn-xs' id='custId' data-toggle='modal' data-id=".$staff['npm'].">Detail</a>"; ?> <a href="#" onclick="confirm_modal('bmjstaff_delete.php?&npm=<?php //echo $staff['npm']; ?>');"><span class="btn btn-danger btn-xs">Hapus</span></a> --> </td> </tr> </tbody> <?php } ?> </div>
Tagged:
Sign In or Register to comment.