Hello,
( before we start… yes, I will prepare and sanitize my dynamic fields after I troubleshoot this problem.).
I have been trying to use $wpdb->update and $wpdb->query(“with an update query here”) to update a custom table in a custom database. I have been able to get wpdb->insert to work, but update is not cooperating.
The symptoms include; an update will update the field in the correct row, but it is also inserting (creating) a new row (with new unique primary field, but duplicate of all other data fields).
I have tried typing my query with a variety of single quotes, double quotes, tics, etc etc. I can manually type the update query in MySQL Workbench and it executes as expected, but when I run the query from wordpress, I get this combination of insert and update.
here is the latest version of my query.
$myupdate_customers_name = $formData['customers_name'];
$mydb->query(" update
customers
set
customers_name = '$myupdate_customers_name'
where
customers_id = '1584798494'
");