【发布时间】:2014-11-22 22:36:11
【问题描述】:
在这个函数和其他函数中,如更新、删除和插入,我如何使用 pdo->prefer 处理这段代码中的 sql 注入?
function get_rows($fields = '*', $where = ' 1=1 ') {
$this->_query = "select $fields from {$this->table} where {$where}";
$stm = $this->_pdo->query($this->_query);
if(!$stm)
die(var_export($this->_pdo->errorinfo(), TRUE));
else
return $stm->fetchAll();}
function insert($fields, $data) {
$this->_query = " insert into $this->table ($fields) VALUES ($data)";
$this->_pdo->exec($this->_query);
}
【问题讨论】:
标签: php pdo sql-injection