How to test if Ci successfully inserted data

前端 未结 4 1534
悲&欢浪女
悲&欢浪女 2020-12-08 14:25

In Ci, I\'ve got the following function. How do I test that the query successfully inserted without error\'s?

public function postToWall() {
    $entryData =         


        
4条回答
  •  半阙折子戏
    2020-12-08 15:18

    You can use $this->db->affected_rows() function of codeigniter.

    See more information here

    You can do something like this:

    return ($this->db->affected_rows() != 1) ? false : true;
    

提交回复
热议问题