Title: SQL Errors in Email Logs – wpdb::prepare() Incorrect Usage
Last modified: February 1, 2025

---

# SQL Errors in Email Logs – wpdb::prepare() Incorrect Usage

 *  Resolved [olppa](https://wordpress.org/support/users/olppa/)
 * (@olppa)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/sql-errors-in-email-logs-wpdbprepare-incorrect-usage/)
 * Hi,
 * I’m experiencing issues with the Post SMTP plugin on my WordPress site (WooCommerce
   enabled). When I try to view email logs, I encounter the following errors in 
   my debug log:
 * **`</strong><br>[01-Feb-2025 09:40:32 UTC] PHP Notice: Function wpdb::prepare
   was called <strong>incorrectly</strong>. The query does not contain the correct
   number of placeholders (0) for the number of arguments passed (1). Please see
   <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging
   in WordPress</a> for more information. (This message was added in version 4.8.3.)
   in /var/www/clients/client5/web5/web/wp-includes/functions.php on line 5835<br
   >[01-Feb-2025 09:40:32 UTC] WordPress database error You have an error in your
   SQL syntax; check the manual that corresponds to your MySQL server version for
   the right syntax to use near '%i AS pl ORDER BY pl.<code>time</code> desc LIMIT
   0, 25' at line 1 for query SELECT pl.<code>id</code>,pl.<code>original_subject
   </code>,pl.<code>to_header</code>,pl.<code>success</code>,pl.<code>time</code
   > FROM %i AS pl ORDER BY pl.<code>time</code> desc LIMIT 0, 25 made by do_action('
   wp_ajax_ps-get-email-logs'), WP_Hook->do_action, WP_Hook->apply_filters, PostmanEmailLogs-
   >get_logs_ajax, PostmanEmailQueryLog->get_logs<br>[01-Feb-2025 09:40:32 UTC] 
   PHP Notice: Function wpdb::prepare was called <strong>incorrectly</strong>. The
   query does not contain the correct number of placeholders (0) for the number 
   of arguments passed (1). Please see <a href="https://wordpress.org/support/article/
   debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This
   message was added in version 4.8.3.) in /var/www/clients/client5/web5/web/wp-
   includes/functions.php on line 5835<br>[01-Feb-2025 09:40:32 UTC] WordPress database
   error You have an error in your SQL syntax; check the manual that corresponds
   to your MySQL server version for the right syntax to use near '%i' at line 1 
   for query SELECT COUNT(<em>) as count FROM %i; made by do_action('wp_ajax_ps-
   get-email-logs'), WP_Hook->do_action, WP_Hook->apply_filters, PostmanEmailLogs-
   >get_logs_ajax, PostmanEmailQueryLog->get_total_row_count [01-Feb-2025 09:40:
   32 UTC] WordPress database error You have an error in your SQL syntax; check 
   the manual that corresponds to your MySQL server version for the right syntax
   to use near '%i AS pl ORDER BY pl.<code>time</code> desc' at line 1 for query
   SELECT COUNT(</em>) as count FROM %i AS pl ORDER BY pl.<code>time</code> desc
   made by do_action('wp_ajax_ps-get-email-logs'), WP_Hook->do_action, WP_Hook->
   apply_filters, PostmanEmailLogs->get_logs_ajax, PostmanEmailQueryLog->get_filtered_rows_count
   <br><strong>`**
   I’m using a custom prefix for my database tables.
 * Using Post SMTP version 3.0.2
   I tried deactivating and reactivating the plugin.
   This issue arose while troubleshooting duplicate order confirmation emails. I
   rely on Post SMTP to track outgoing emails, but the error prevents me from accessing
   the logs.
 * Is there a fix or workaround for this issue? Would a patch be released soon?
 * Thanks in advance for your support!
    -  This topic was modified 1 year, 3 months ago by [olppa](https://wordpress.org/support/users/olppa/).

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

 *  Plugin Support [M Aqib Khan](https://wordpress.org/support/users/aqibkhan9/)
 * (@aqibkhan9)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/sql-errors-in-email-logs-wpdbprepare-incorrect-usage/#post-18282020)
 * Hello [@olppa](https://wordpress.org/support/users/olppa/)
 * We hope this message finds you well.
 * Thank you for reaching out to our Support team. We are saddened and concerned
   that you have to face this issue. As the error seems to be caused due to an old
   WordPress version. Could you please share the WordPress versions?
 * I look forward to your response & an opportunity to assist you.
 * Warm regards,
   Support Team – WP Experts
 *  Plugin Support [M Aqib Khan](https://wordpress.org/support/users/aqibkhan9/)
 * (@aqibkhan9)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/sql-errors-in-email-logs-wpdbprepare-incorrect-usage/#post-18299256)
 * Hello [@olppa](https://wordpress.org/support/users/olppa/) ,
 * We hope this message finds you well.
 * We are reaching out to follow up on our previous communication, as we haven’t
   received a response from you. We hope everything is going smoothly on your end.
 * Please do not hesitate to contact us if you have any questions or concerns. We
   are here to assist you.
 * Warm regards,
   Support Team – WP Experts
 *  Plugin Support [M Aqib Khan](https://wordpress.org/support/users/aqibkhan9/)
 * (@aqibkhan9)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/sql-errors-in-email-logs-wpdbprepare-incorrect-usage/#post-18309959)
 * Hi @olppa  ,
 * We hope this message finds you well.
 * As we haven’t heard back from you in the last 10 days, we will be automatically
   closing this support request for now.
 * If you still need assistance, please feel free to open a new thread & We’ll be
   happy to help!
 * Cheers,
   Support Team – WP Experts

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

The topic ‘SQL Errors in Email Logs – wpdb::prepare() Incorrect Usage’ is closed
to new replies.

 * ![](https://ps.w.org/post-smtp/assets/icon-128x128.gif?rev=3209655)
 * [Post SMTP – Complete Email Deliverability and SMTP Solution with Email Logs, Alerts, Backup SMTP & Mobile App](https://wordpress.org/plugins/post-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/post-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-smtp/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [M Aqib Khan](https://wordpress.org/support/users/aqibkhan9/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/sql-errors-in-email-logs-wpdbprepare-incorrect-usage/#post-18309959)
 * Status: resolved