Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Controller */
- public function index(){
- $data = $this->SkripsiModel->ambilData();
- $jumlah = $this->SkripsiModel->jumlahData();
- $this->load->view('skripsi_view', compact('data', 'jumlah'));
- }
- /* Model */
- function ambilData(){
- return $this->db->get('tbl_kategori')->result_array();
- }
- function jumlahData(){
- return $this->db->count_all('tbl_kategori');
- }
- /* View */
- <table border="1" cellpadding="5" cellspacing="3" style="border-collapse: collapse;">
- <tr>
- <th>Nama Karyawan</th>
- <?php
- foreach ($data as $row) {
- echo "<th>".$row['nama_kategori']."</th>";
- }
- ?>
- </tr>
- <?php
- for ($i=1; $i <=5 ; $i++) {
- ?>
- <tr>
- <td>Karyawan <?php echo $i;?></td>
- <?php
- for ($ii=1; $ii <= $jumlah ; $ii++) {
- ?>
- <td><?php echo form_input('karyawan_'.$i, '');?></td>
- <?php
- }
- ?>
- </tr>
- <?php
- }
- ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement