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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -