取决于对您来说最重要的是什么 - 简单的编码和几行或正确的方法来避免 sql 注入。只要您不使用庞大的数据库,它对速度没有影响,所以最好不要使用它,您可以编写如下代码
$result = $this->db->select('SELECT * FROM tbl_users WHERE login = :login AND password = :password', $arraiul);
或者像那样
function editusers(){
$id = $_POST['id'];
$name = $_POST['name'];
$login = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$power = $_POST['power'];
if ($password ==''){
$sqlstm = "UPDATE tbl_users SET name='$name', login='$login', email='$email', power='$power' WHERE id='$id'";
} else {
$sqlstm = "UPDATE tbl_users SET name='$name', login='$login', password=MD5('$password'), email='$email', power='$power' WHERE id='$id'";
}
$sth = $this->db->prepare($sqlstm);
$sth->execute();
}
enter code here