三元如果php在codeigniter中受影响的行

时间:2015-11-30 12:24:01

标签: php codeigniter

也许,这是一个愚蠢的问题。但是如果我有这样的代码,我真的要知道使用三元组:

public function add_tank_type($data) {
    $this->db->insert('tb_tank_type', $data);
    if ($this->db->affected_rows() > 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}

非常感谢ANy解决方案。

1 个答案:

答案 0 :(得分:0)

$result = ($this->db->affected_rows() > 0)  ? TRUE :  FALSE;
相关问题