I have to run a query after every update and I want to know if there is a way to automate a $this->db->query() before every $this->db->update()
I’m using it for log.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you can write your own function in the file
core/MY_Model.phpto do that:where:
$queryis your actual query:SELECT * FROM ...$updateis an array of two elements$update['table']is the table to update and$update['data']is the updating data as specified on codeigniter active record’s documentationthen make every model extend MY_Model
and every time you need to update something: