I am developing a wordpress plugin but I am facing a problem. I would like to update an existing value of a table in a MySQL database. After some research, I saw that you can use this method:
global $wpdb;
$wpdb->query($wpdb->prepare("UPDATE myTable SET name=$name WHERE id=$idTable"));
However when I run my code, I get this error in the javascript console:
Uncaught Error: Call to a member function query() on null
Do you have an idea how to solve this problem ?
source https://stackoverflow.com/questions/70137262/mysql-update-query-in-wordpress-plugin-not-working
Comments
Post a Comment