Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax
-
I am getting a fatal error from WordPress when I try to install contact-form related plugins like WPforms and Ninja Forms. It has something to do with line 2056 in the wp-db.php file. I am using a theme and have no experience whatsoever with PHP coding, so I don’t even know where to start. I am glad I found the php file at all.
These are my 2 errors:
Upon activating WPforms:
Fatal error: Uncaught mysqli_sql_exception: Table 'postsam_wp1.wp_wpforms_tasks_meta' doesn't exist in /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php:2056 Stack trace: #0 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php(2056): mysqli_query() #1 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php(1945): wpdb->_do_query() #2 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php(2695): wpdb->query() #3 /home/postsam/domains/astrosofie.nl/public_html/wp-admin/includes/upgrade.php(2749): wpdb->get_results() #4 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/wpforms-lite/src/Tasks/Meta.php(117): dbDelta() #5 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/wpforms-lite/includes/class-install.php(133): WPForms\Tasks\Meta->create_table() #6 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/wpforms-lite/includes/class-install.php(59): WPForms_Install->run() #7 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/class-wp-hook.php(303): WPForms_Install->install() #8 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #9 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/plugin.php(470): WP_Hook->do_action() #10 /home/postsam/domains/astrosofie.nl/public_html/wp-admin/plugins.php(193): do_action() #11 {main} thrown in /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php on line 2056
Upon activating Ninja forms:
Fatal error: 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 1 in /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php:2056 Stack trace: #0 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php(2056): mysqli_query() #1 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php(1945): wpdb->_do_query() #2 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php(2695): wpdb->query() #3 /home/postsam/domains/astrosofie.nl/public_html/wp-admin/includes/upgrade.php(2749): wpdb->get_results() #4 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/ninja-forms/includes/Database/Migrations/Forms.php(47): dbDelta() #5 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/ninja-forms/includes/Abstracts/Migration.php(134): NF_Database_Migrations_Forms->run() #6 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/ninja-forms/includes/Database/Migrations.php(40): NF_Abstracts_Migration->_run() #7 /home/postsam/domains/astrosofie.nl/public_html/wp-content/plugins/ninja-forms/ninja-forms.php(1039): NF_Database_Migrations->migrate() #8 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/class-wp-hook.php(303): Ninja_Forms->activation() #9 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #10 /home/postsam/domains/astrosofie.nl/public_html/wp-includes/plugin.php(470): WP_Hook->do_action() #11 /home/postsam/domains/astrosofie.nl/public_html/wp-admin/plugins.php(193): do_action() #12 {main} thrown in /home/postsam/domains/astrosofie.nl/public_html/wp-includes/wp-db.php on line 2056
Now here is the part of the php file that holds line 2056. Obviously I don’t know what to think of it, since I don’t know PHP. Hopefully someone can point me in the right direction?
/** * Internal function to perform the mysql_query() call. * * @since 3.9.0 * * @see wpdb::query() * * @param string $query The query to run. */ private function _do_query( $query ) { if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { $this->timer_start(); } if ( ! empty( $this->dbh ) && $this->use_mysqli ) { LINE 2056 $this->result = mysqli_query( $this->dbh, $query ); } elseif ( ! empty( $this->dbh ) ) { $this->result = mysql_query( $query, $this->dbh ); } $this->num_queries++; if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { $this->log_query( $query, $this->timer_stop(), $this->get_caller(), $this->time_start, array() ); } }
- The topic ‘Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax’ is closed to new replies.