Hot answers tagged mysql
You should be fine deleting empty custom fields. The main reason is, that get_post_meta( $id, 'metakey', true ) returns an empty string if the field is not set, so it is the same as having an empty record set. get_post_meta( $id, 'metakey', false ), returns an empty array if no value is set, so you should be fine too. The only problem you could face is ...
You have the following methods of the $wpdb object: $wpdb->flush() that contains a call to mysqli_free_result() or mysql_free_result() if not supported. $wpdb->check_connection() that contains a call to mysqli_ping() or mysql_ping() if not supported. You can of course use all your PHP functions in WordPress. Here's an example based on the \wpdb ...
It looks like problem is coming from any of installed plug in or your theme. Backup your database. Switch to default wordpress theme. If problem disappears, your theme is the culprit. If problem still exists, Deactivate all installed plugins. If problem disappears, activate plugins one by one and see which plugin causes the error. If problem still exists, ...
There are many wordpress plugins which are not written correctly. Or some plugins are written for old version of wordpress. Please test your plugins. One of them might be causing the problem. Please refer the steps indicated by @karthik for detailed testing.
Only top voted, non community-wiki answers of a minimum length are eligible