I have a few questions about database manipulation in Vanilla forums. I am using version 3.3. How do you update a record in a database in vanilla forums? I tried just using the regular algorithm used, but it does not work.
I use MySQL Workbench
What is the "regular algorithm"? If you say what you have done right now, it would be easier to give advice. From within a plugin you would either use the model or a model and the methods update or setField.
DiscussionModel::instance()->setField($discussionID, 'InsertUserID', 9);
$someModel = new Gdn_Model('SomeTable');
$someModel->update(['Name' => 'New Name', 'Body' = 'New Body'], ['ID' => 3]);
By "regular algorithm", I mean the MySQL one. Here is a link to the algorithm I used: https://www.w3schools.com/php/php_mysql_update.asp
I used the mysqli object oriented version. How do you use the examples you gave me? Where do you insert those codes? Is there any other codes that needs to go with them?
As I've said "from within a plugin": https://docs.vanillaforums.com/developer/addons/addon-quickstart/
If you want to extend Vanillas functionality, the cleanest approach is to write a plugin. If you have set up a basic plugin, you can put the code above e.g. in a method "public function pluginController_dbtest_create()" so that it will be executed when you visit yourforum.com/plugin/dbtest
public function pluginController_dbtest_create()
Thanks for the help R_I. I will give it a try.