my_model save() method

edited July 2016 in News & Announcements
Hi,

I have created a module (extending from Base_module_model) and I am attempting to save a record.
The following are the statements run, the first to save the record, the second and third logs some output (the query run and the result of the query:

-----
$result = $this->save(array( 'vacancy_id' => $vacancyId, 'email_id' => $emailId ));
log_message( 'error', "debug:>>>\n" . print_r( $this->debug_query(FALSE, FALSE, TRUE) , 1 ) );
log_message( 'error', "result:>>>\n" . print_r( $result, 1 ) );
-----

The following is the output. It seems that the save method is using sql SELECT, and I cannot figure out why.

-----
ERROR - 2016-07-19 12:33:34 --> debug:>>>
SELECT *
FROM `vacancies_mail_list_sent`
WHERE `email_id` = '6'
AND `vacancy_id` = '3'

ERROR - 2016-07-19 12:33:34 --> result:>>>

-----

Can you shine any light on as to why this may be happening?

Thank you in advance for any help.

Andy

Comments

  • edited 10:44PM
    Looks like you'll need to dig into MY_Model::save() to see what's happening
  • edited 10:44PM
    I've solved it, I have used insert() instead of save().
Sign In or Register to comment.