Created
March 2, 2017 07:22
-
-
Save tri82wiyono/174dd58773bb446c49b9ca275f00dea8 to your computer and use it in GitHub Desktop.
buat helper di CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ceritanya gini, saya ada buat scoring credit, didalam fiturnya itu saya | |
ada buat parameter umur, misalnya : | |
deskripsi = < 20 tahun | |
bobot = 4 | |
nilai = 1 | |
jumlah = 4 | |
nah jadi misalnya user memilih umur pada combox <20 tahun, | |
maka yang tersimpan ke tabel adalah jumlah = 4. nah pada saat mau ditampilan | |
di view yang muncul 4, tentunya saya tidak mau karena nilainya kelihatan juga membingunkan user nantinya | |
kalau user tidak paham. nah jadi saya ingin mengaliaskan angka 4 tadi menjadi <20 tahun, ceranya seperti apa | |
ya contoh helpernya seperti dibawah ini. | |
*/ | |
<?php | |
static public function getUmur($jumlah){ | |
$CI =& get_instance(); | |
$age = $CI->db->get("sc_umur"); | |
foreach ($age->result() as $umur){ | |
if($umur->jumlah == $jumlah){ | |
echo $umur->deskripsi; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment