Title: SQL Syntax Errors
Last modified: May 5, 2025

---

# SQL Syntax Errors

 *  [icmcnamara](https://wordpress.org/support/users/icmcnamara/)
 * (@icmcnamara)
 * [1 year ago](https://wordpress.org/support/topic/sql-syntax-errors-3/)
 * FormCraft v1.2.11, WP 6.8.1
 * Getting the following error when attempting to edit a form:
 * `[05-May-2025 20:05:08 UTC] WordPress database error 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 ''wpws_formcraft_b_forms' WHERE id = 5' at line
   1 for query SELECT * FROM 'wpws_formcraft_b_forms' WHERE id = 5 made by do_action('
   toplevel_page_formcraft_basic_dashboard'), WP_Hook->do_action, WP_Hook->apply_filters,
   formcraft_basic_dashboard, require_once('/plugins/formcraft-form-builder/views/
   builder.php')`
 * I’ve traced this to the following line in builder.php
 * `$qry = $wpdb->get_results( $wpdb->prepare("SELECT * FROM %s WHERE id = %d", 
   $forms_table, $form_id));`
 * Preparing the statement in this fashion includes the table name as a single quoted
   string, which causes the error. I’ve resolved this issue by updating the code:
 * `$qry = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $forms_table WHERE 
   id = %d", $form_id));`
 * —-
 * There’s another syntax error in formcraft-main.php, line 473. There’s an extra
   comma following the table name in the statement.
 * Continuing to troubleshoot here and will fix these issues locally, but I hope
   that they can be addressed by a future update.
 * Thanks!

The topic ‘SQL Syntax Errors’ is closed to new replies.

 * ![](https://ps.w.org/formcraft-form-builder/assets/icon-256x256.png?rev=1107363)
 * [FormCraft - Form Builder](https://wordpress.org/plugins/formcraft-form-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/formcraft-form-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/formcraft-form-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/formcraft-form-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/formcraft-form-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/formcraft-form-builder/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [icmcnamara](https://wordpress.org/support/users/icmcnamara/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/sql-syntax-errors-3/)
 * Status: not resolved