How to test if Ci successfully inserted data

前端 未结 4 1480
悲&欢浪女
悲&欢浪女 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:01

    if you are using bootstrap on codeigniter try flash message or simply redirect

    $added = $this->your_modal->function_reference($data);
    
    
    if ($added) {
        $this->session->set_flashdata('success', 'Added successfully.');
        redirect('home');
    } else {
        $this->session->set_flashdata('error', 'Something wrong.');
        redirect('home');
    

    ON CONTROLLER

提交回复
热议问题