how to avoid sql injection in codeigniter

前端 未结 6 1994

In CodeIgniter, how can I avoid sql injection? Is there any method to set in config file to avoid sql injection? I am using this code for selecting values:



        
6条回答
  •  时光取名叫无心
    2020-11-29 20:03

    While accepting value from client side, Better to use this code,

    $client = $this->input->post('client',TRUE);
    

    While inserting better to use codeigniter inserting method,

    $this->db->insert('tablename',$values);
    

    When using this method codeingniter automatically do all escape so we no need do escape manual.

提交回复
热议问题