【发布时间】:2017-11-06 23:03:10
【问题描述】:
注意:对于Does CodeIgniter automatically prevent SQL injection? 或how to avoid sql injection in codeigniter,我的问题不是重复问题,因为它询问了query() 函数。我在问像insert(), update() , where(), order_by()这样的功能?
我问的是以下类型的查询是否也会自动阻止 SQL 注入?
01.
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->where('school', $school);
$this->db->update('mytable', $data);
02
$this->db->select('*');
$this->db->from('table_name');
$this->db->where('pro_name', $pro_name);
$this->db->order_by($pro_type, 'desc');
$query = $this->db->get();
return $query->result_array();
假设所有变量都是 GET 或 POSTS 值。
【问题讨论】:
-
@GhanshyamBhava 这也不是一个重复的问题,因为它也被问到
query()函数。我在问像`insert()、update()、where()、order_by()`这样的函数? -
这能回答你的问题吗? how to avoid sql injection in codeigniter
标签: codeigniter codeigniter-3 sql-injection