How to avoid display of "Success" message?

How to avoid display of "Success" message?

by Joseph Rézeau -
Number of replies: 4
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
When using an execute_sql ($sql), I can see the "Success" message displayed briefly. Even with debug mode OFF. How can I get read of this message?
Joseph
PS.- The $sql contains the following: "UPDATE ".$CFG->prefix."glossary SET specialalphabets = '".$specialalphabets."' WHERE mdl_glossary.id = ".$glossary_id;
I've tried to use moodle API's update_record() but can't get it to work.
Any suggestions?
Average of ratings: -
In reply to Joseph Rézeau

Re: How to avoid display of "Success" message?

by Dan Ballance -
If I remember correctly, an extra optional param needs to be passed in as false to indicate you do not want the html response. For some crazy reason this defaults to true and thus your confusion!

hope this helps,

dan smile
In reply to Joseph Rézeau

Re: How to avoid display of "Success" message?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You should not use execute_sql for things like this. It is only really intended for use in upgrade code.

You can do what you are trying to do with set_field.
In reply to Tim Hunt

Re: How to avoid display of "Success" message?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Of course, it's much better to use set_field.blush
Thanks Tim!