简体   繁体   English

使用Grocery CRUD CodeIgniter获取自定义字段值

[英]get custom field value using Grocery CRUD CodeIgniter

How can i get value of a field from another table on my method? 如何从我的方法的另一个表中获取字段的值? and of course i have the primary key of its table. 当然,我有它表的主键。 i want to do something in add/edit action like this 我想在添加/编辑动作中做这样的事情

if(is_empty(value_field_from_another_table)){
    $crud->edit_fields('first','second');
    $crud->add_fields('first','second');
}else{
    $crud->edit_fields('first');
    $crud->add_fields('first');
}
$query = $this->db->get_where('mytable', array('id' => $id), $limit, $offset);

or

$query = $this->db->get('mytable');


foreach ($query->result() as $row)
{
    echo $row->title;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM