foreach ($row['tarif'] as $layanan => $tarif) { /* buat output table baris */ $etd = isset($tarif['etd']) ? $tarif['etd'] : 'N/A'; if ($first == $layanan) { $output .= ' <tr> <td rowspan="' . $count . '" class="row-center">' . $row['provinsi'] . '</td> <td rowspan="' . $count . '" class="row-center">' . JNE_normalize($row['kota']) . '</td> <td rowspan="' . $count . '" class="row-center">' . JNE_normalize($row['kecamatan']) . '</td> <td class="text-center">' . strtoupper($layanan) . '</td> <td class="text-center">' . JNE_rupiah($tarif['harga']) . '</td> <td class="text-center">' . $etd . '</td> </tr>'; } else { $output .= ' <tr> <td class="text-center">' . strtoupper($layanan) . '</td> <td class="text-center">' . JNE_rupiah($tarif['harga']) . '</td> <td class="text-center">' . $etd . '</td> </tr>'; } } } $x++; } // ajax pagination $paging['pages'] = ceil($paging['total'] / $paging['limit']); $paging['page'] = intval($paging['offset'] / $paging['limit']) + 1; // output pagination numbers $anchor = JNE_pagination($paging, 10); include 'table-data-new.php';
$first = array_shift(array_keys($row['tarif'])); // ambil array key elemen pertama $count = count($row['tarif']); // jumlah data tarif foreach ($row['tarif'] as $layanan => $tarif) { /* buat output table */ if ($first == $layanan) { $output .= ' <tr> <td rowspan="' . $count . '" class="row-center">' . sprintf('%s, %s', $row['provinsi']['nama'], $row['kotamadya']) . '</td> <td rowspan="' . $count . '" class="row-center">' . JNE_normalize($row['kecamatan']) . '</td> <td class="text-center">' . strtoupper($layanan) . '</td> <td class="text-center">' . JNE_rupiah($tarif) . '</td> </tr>'; } else { $output .= ' <tr> <td class="text-center">' . strtoupper($layanan) . '</td> <td class="text-center">' . JNE_rupiah($tarif) . '</td> </tr>'; } } } $x++; } // ajax pagination $paging['pages'] = ceil($paging['total'] / $paging['limit']); $paging['page'] = intval($paging['offset'] / $paging['limit']) + 1; // output pagination numbers $anchor = JNE_pagination($paging, 5); include 'table-data.php';