To quick sum, in the both table have its own status with enum function (I set the default value into PENDING)
when I use this function in other controller, the function work out of the box
function desain($tanggalsubmit=0) { $crud = new grocery_CRUD(); $crud->set_table('desain') ->where('status','PENDING') ->fields('nama','desain','status') ->set_field_upload('desain','assets/uploads/desain') ->field_type('status','enum',array('REJECTED','APPROVED')) ->unset_add() ->unset_delete() ->field_type('desain','readonly') ->field_type('nama','readonly') ->field_type('tanggal','hidden',$tanggalsubmit); $output = $crud->render(); $this->kekgwpeduliaja($output); }
but when I use the similar function
function pembayaran() { $crud = new grocery_CRUD; $crud->set_table('pembayaran') ->where('status','PENDING') ->set_relation('idorder','pesanan','id') ->set_relation('bankasal','daftarbank','namabank') ->field_type('nama','readonly') ->field_type('bankasal','readonly') ->field_type('norekening','readonly') ->field_type('banktujuan','readonly') ->field_type('tanggalbayar','readonly') ->field_type('jumlah','readonly') ->field_type('bukti','readonly') ->callback_column('jumlah',array($this,'valueToIDR')) ->field_type('status','enum',array('LUNAS')) ->set_field_upload('bukti','assets/uploads/bukti') ->unset_add() ->unset_delete(); $output = $crud->render(); $this->kekgwpeduliaja($output); }
it triggered error
A Database Error Occurred Error Number: 1052 Column 'status' in where clause is ambiguous SELECT `pembayaran`.*, je60da834.id AS se60da834, j6c1fdcc5.namabank AS s6c1fdcc5 FROM (`pembayaran`) LEFT JOIN `pesanan` as je60da834 ON `je60da834`.`id` = `pembayaran`.`idorder` LEFT JOIN `daftarbank` as j6c1fdcc5 ON `j6c1fdcc5`.`id` = `pembayaran`.`bankasal` WHERE `status` = 'PENDING' LIMIT 25 Filename: E:\xampp\htdocs\pluto\system\database\DB_driver.php Line Number: 330
a quick look of my db relation and its columns
my current solution is to disable the the
->field_type('status','enum',array('LUNAS'))
in the pembayaran function, but I need the field_type function there.
I was confused, my current solution is to disable the
->where('status','PENDING')
in pembayaran table, but I need the 'where' to sort the list
Thanks before :D
---edit
nvm, I will just disable the 'where' and sort it with GC function.
its for the admin anyway :D