Mysql insert not saving
-
Hi,
I am having trouble saving a row to the DB. I have a plugin that i have modified slightly (added one extra column in the DB table). When it saves to the DB, the query returns successfully and has a value of the ID (auto-incremented in MySQL), but the row does not get saved. The code is fairly vanilla:
$query = $wpdb->prepare($query, $values); $query_results = $wpdb->query($query); if($query_results) { return $wpdb->insert_id; }So this works for two other calls in the same form action,
$wpdb->insert_idcontains the next valid auto-id, but no rows are in the DB. I have tried turning on all the logging I can, and there are no errors at all.$wpdb->show_errors();has no content.Also the SQL seems to be OK – I can use the text from
$queryor$wpdb->last_queryin a DB window and they work fine, and insert a row that I can see.I was guessing there was a transaction on that table, so copied the DB to a new one and reran, but had the same results.
I am not sure how to debug this further. I don’t have access to the error logs in the DB itself as it is on a shared host.
The server is MySql 5.6.34, PHP 5.6.28.
If anyone has any ideas or tips on moving forward, please let me know.
Thanks!
The topic ‘Mysql insert not saving’ is closed to new replies.