$sql= sprintf("select * from `$table[admin_table]` where user_id=%s and user_passwd=password(%s)",$d->Quote_smart($_POST['username']),$d->Quote_smart($_POST['password']));
$this->db->get_where($this->table, array('user_id'=>$_POST['username'], 'user_password'=>password($_POST['password'])));
array로 보내야 하는데 모르겠습니다.
$this->db->query("select * from {$this->table} where user_id='{$theuser_id}' and user_passwd=password('{$theuser_passwd}')");
$this->db->where("user_id", $this->input->post('user_id')); $this->db->where("user_password = password('{$this->input->post('password')}')", NULL, FALSE); $this->db->get($table_name);
처음 접하게 되면 해석(?)이 잘 되지 않는 것이 사실 입니다.
http://cikorea.net/user_guide_2.1.0/database/active_record.html#select
여기를 살펴보게 되면 Select 마지막 절에 사용하는 방법이 나옵니다.
$this->db->where("user_password = password('{$_POST['password']}')", NULL, FALSE);단, 이렇게 사용시 SQL 인젝션 관련 문제가 발생 할 수도 있으므로 코더의 세심한 주의가 필요 합니다.* 보너스
Select시 함수 사용법
$this->db->select("password('1111')", FALSE);Insert 또는 Update 시 함수 사용법$this->db->set('reg_time', 'sysdate()', FALSE); $this->db->set('no', 'no+1', FALSE);