Welcome Guest, Not a member yet? Register   Sign In
condition on add_row
#1

[eluser]teguh pribadi[/eluser]
Hey master...

I Need help about my program. it about the condition on CI. Its the Code:
Code:
foreach ($babs as $bab)
    {
     // Menghitung jumlah baris data sesuai bab_id
      $babe=$bab->bab_id;
      $num_e = $this->materi_model->jumlah_bar($babe);
    
     // Penyusunan data baris per baris, perhatikan pembuatan link untuk updat dan delete
     $this->table->add_row( ++$i, //kolom nomor
           $babe, //kolom bab_id
           $bab->bab_nama, //kolom bab_nama
           $bab->bab_ket, //kolom bab_ket
           $bab->bab_status, //kolom bab_status
           anchor('Bab/bab_update/'.$bab->bab_id,'Edit'),
           if ($num_e == 0)
           {
            anchor('Materi/buat/'.$bab->bab_id,'Buat Materi',array('class' => 'update'))
           }
           else
           {
            anchor('Materi/buat_proses/'.$bab->bab_id,'Update Materi',array('class' => 'update'))
           }
          );
    }

The error start on LINE 97 (if ($num_e == 0)........) until end.
The page shown "Parse error: syntax error, unexpected T_IF in ................application\controllers\Bab.php on line 97"
How Must I do?
#2

[eluser]InsiteFX[/eluser]
Code tags are all lowercase not upper case.

Code:
$num_e = null // nothing found

Use var_dump to see what you getting.




Theme © iAndrew 2016 - Forum software by © MyBB