Title: Fatal error: Uncaught mysqli_sql_exception
Last modified: January 8, 2026

---

# Fatal error: Uncaught mysqli_sql_exception

 *  Resolved [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [3 months, 1 week ago](https://wordpress.org/support/topic/fatal-error-uncaught-mysqli_sql_exception-3/)
 * Have installed Query Monitor, and during Abandoned Cart Recovery for WooCommerce
   de/activation the following fatal error happens:
 *     ```wp-block-code
       Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IF' at line 1in /public_html/wp-includes/class-wpdb.php on line 2357Call stack:    mysqli_query()    wp-includes/class-wpdb.php:2357    wpdb::_do_query()    wp-includes/class-wpdb.php:2271    wpdb::query()    wp-includes/class-wpdb.php:3156    wpdb::get_results()    wp-admin/includes/upgrade.php:2998    dbDelta()    wp-content/plugins/woo-abandoned-cart-recovery/includes/plugin.php:120    WACV\Inc\Plugin::create_database()    wp-content/plugins/woo-abandoned-cart-recovery/includes/plugin.php:67    WACV\Inc\Plugin::single_active()    wp-content/plugins/woo-abandoned-cart-recovery/includes/plugin.php:62    WACV\Inc\Plugin::activate()    wp-content/plugins/woo-abandoned-cart-recovery/woo-abandoned-cart-recovery.php:114    WACVPInit_F::wacv_activate()    wp-includes/class-wp-hook.php:341    WP_Hook::apply_filters()    wp-includes/class-wp-hook.php:365    WP_Hook::do_action()    wp-includes/plugin.php:522    do_action()    wp-admin/includes/plugin.php:703    activate_plugin()    wp-admin/plugins.php:60
       ```
   
 * The “IF NOT EXISTS” seems to be the culprit. `dbDelta( $query )` should be doing
   that check already anyway.
 * The suggested changes to `woo-abandoned-cart-recovery\includes\plugin.php` that
   fixed the issue for me:
 *     ```wp-block-code
       $query = "CREATE TABLE IF NOT EXISTS {$abd_record_tb} // line ~92to:$query = "CREATE TABLE {$abd_record_tb}$query = "CREATE TABLE IF NOT EXISTS {$guest_record_tb} ( // line ~124to:$query = "CREATE TABLE {$guest_record_tb} ($query = "CREATE TABLE IF NOT EXISTS {$mail_log_tb} ( // line ~158to:$query = "CREATE TABLE {$mail_log_tb}$query = "CREATE TABLE IF NOT EXISTS {$cart_log_tb} (  // line ~176to:$query = "CREATE TABLE {$cart_log_tb} (
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [3 months, 1 week ago](https://wordpress.org/support/topic/fatal-error-uncaught-mysqli_sql_exception-3/#post-18779345)
 * This is a non-issue. The reason was a redundant `wp-content\db.php` remaining
   from another plugin that’s creating havoc. My apologies.
 *  [angelagrey](https://wordpress.org/support/users/angelagrey/)
 * (@angelagrey)
 * [3 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-mysqli_sql_exception-3/#post-18781287)
 * Hi,
 * Thanks for the update and for letting me know. I’m glad you were able to identify
   the cause.
 * If you need any further assistance, feel free to reach out anytime.
 * Best regards

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffatal-error-uncaught-mysqli_sql_exception-3%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/woo-abandoned-cart-recovery/assets/icon-256x256.gif?rev=
   3081786)
 * [Abandoned Cart Recovery for WooCommerce](https://wordpress.org/plugins/woo-abandoned-cart-recovery/)
 * [Support Threads](https://wordpress.org/support/plugin/woo-abandoned-cart-recovery/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-abandoned-cart-recovery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-abandoned-cart-recovery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-abandoned-cart-recovery/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [angelagrey](https://wordpress.org/support/users/angelagrey/)
 * Last activity: [3 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-mysqli_sql_exception-3/#post-18781287)
 * Status: resolved