php - Codeigniter: Delete query with prepared statement -
i'm not sure if codeigniter thing or mysqli thing.
in model class i'm trying delete using 2 arguments:
$query = "delete users user_id = ? , company_id = ?"; $result = $this->db->query( $query, $user_id, '1' );
error message: have error in sql syntax; check manual corresponds mysql server version right syntax use near '? , company_id = ?' @ line 1
any ideas?
i recommend use 'active record'
$this->db->where('user_id', $user_id); $this->db->where('company_id', 1); $this->db->delete('users');
https://ellislab.com/codeigniter/user-guide/database/active_record.html
Comments
Post a Comment