"PHP message: WordPress database error Unknown column 'posts.ID' in 'on clause' for query SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id FROM wp_tkqbrzh17a_posts AS orders INNER JOIN wp_tkqbrzh17a_woocommerce_order_items AS order_items ON orders.ID = order_id INNER JOIN wp_tkqbrzh17a_woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id INNER JOIN wp_tkqbrzh17a_woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id INNER JOIN wp_tkqbrzh17a_postmeta AS currency_postmeta ON posts.ID = currency_postmeta.post_id WHERE orders.post_type IN ( 'shop_order' ) AND orders.post_status IN ( 'wc-completed','wc-processing','wc-on-hold' ) AND order_item_meta.meta_key = '_qty' AND order_item_meta_2.meta_key = '_product_id' AND orders.post_date_gmt >= '2024-07-01' AND orders.post_date_gmt <= '2024-07-19 13:27:34' AND currency_postmeta.meta_key = '_order_currency'"
I inspected the php table “posts” which clearly has ID (posts.ID) column available. I need guidance on this. This could be a small conflict between Woocmmerce and WPML. Yet WPML says it’s related to other plugins, I have disabled all plugins on the site and reverted to WP default theme, yet this error shows up again.
]]>I encountered a SQL syntax error in CoAuthorsPlus plugin when running a WP-CLI command wp co-authors-plus assign-user-to-coauthor
. The error message is as follows:
[11-Jul-2024 04:19: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 '','page)' at line 1 for query SELECT ID FROM wp_posts WHERE post_author=270 AND post_type IN (post','page) made by...
The problem lies in the SQL query construction in co-authors-plus/php/class-wp-cli.php
at line 238. The code currently is:
$post_types = implode( "','", $coauthors_plus->supported_post_types() );
$posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author=%d AND post_type IN ({$post_types})", $user->ID ) );
This results in an SQL syntax error because the post_type values are not properly enclosed in single quotes in the IN clause.
Proposed Fix:
// add single quotes
$posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author=%d AND post_type IN ('{$post_types}')", $user->ID ) );
I hope this issue can be resolved quickly.
Thank you!
]]>Hello, our hosting company mailed us to warn about a SQL error made by this plugin in some tables. Can you help us by fixing it? Many thanks
]]>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 'm based in Europe";}s:15:"gdpr-accept-elp";s:1:"1";s:5:"track";s:0:"";s:10:"u...' at line 2
Component: Plugin: contact-form-cfdb7
Caller: CFDB7_Form_Details->form_details_page()
Query: UPDATE?wp_db7_forms
SET?form_value = 'a:21:{s:12:"cfdb7_status";s:4:"read";s:14:"first-name-elp";s:4:"test";s:13:"last-name-elp";s:4:"test";s:9:"email-elp";s:13:"[email protected]";s:9:"phone-elp";s:8:"11111111";s:16:"organization-elp";s:9:"Amogus";s:10:"region-elp";a:1:{i:0;s:19:"I'm based in Europe";}s:15:"gdpr-accept-elp";s:1:"1";s:5:"track";s:0:"";s:10:"utm_source";s:0:"";s:10:"utm_medium";s:0:"";s:12:"utm_campaign";s:0:"";s:11:"utm_content";s:0:"";s:8:"utm_term";s:0:"";s:7:"persona";s:0:"";s:3:"sdr";s:0:"";s:7:"company";s:0:"";s:7:"product";s:0:"";s:5:"gclid";s:0:"";s:6:"utm_id";s:0:"";s:12:"containerURL";s:0:"";}'
WHERE?form_id = '14'
LIMIT?1
PHP: 8.1.20?
DB : 10.6.14-MariaDB
img_optm
! SQL:?CREATE TABLE IF NOT EXISTS wpso_litespeed_img_optm
() DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
.Negeer deze melding.”img_optming
! SQL:?CREATE TABLE IF NOT EXISTS wpso_litespeed_img_optming
() DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
.”Manual SQL Error: [1146] Table ‘*_wppanel.iwp_addons_v3′ doesn’t exist in file /WPPanel/index.php On line 11
SELECT slug, status FROM iwp_addons_v3 WHERE slug IN(‘scheduleBackup’, ‘clientReporting’, ‘wpOptimize’)
I read a solution would be to switch the panel to v3, that doesn’t do anything so it seems. Tested on PHP 7.4 and 8.0, no difference, didn’t work in both cases.
Did a restore of the backup and went back to 2.15.9, all working well again.
Using the “switch to v3” crashes it (PHP 8.0)
Fatal error: Uncaught ArgumentCountError: Too few arguments to function appErrorHandler(), 4 passed and exactly 5 expected in /home/username/domains/userdomain.nl/public_html/WPPanel/v3/includes/commonFunctions.php:510 Stack trace: #0 /home/username/domains/userdomain.nl/public_html/WPPanel/v3/includes/db.php(43): appErrorHandler() #1 /home/username/domains/userdomain.nl/public_html/WPPanel/v3/controllers/appFunctions.php(10): DB::connect() #2 /home/username/domains/userdomain.nl/public_html/WPPanel/v3/includes/app.php(65): DBConnectAndSetOptions() #3 /home/username/domains/userdomain.nl/public_html/WPPanel/v3/index.php(2): include(‘…’) #4 {main} thrown in /home/username/domains/userdomain.nl/public_html/WPPanel/v3/includes/commonFunctions.php on line 510
Using the “switch to v3” running on php 7.4 doesn’t do anything so it seems, it keeps running on the old panel.
So I’m kind of stuck.
(note: i checked the error logs of the server, nothing found in regards to the “switch to v3”).
]]>However the steps did not helped and I cannot log to admin panel.
When I try to log there, the error appears saying that the user is not existing.
However, I checked directly in DB and this user exists (tried both email and nickname). I have even reset the password, but still same result.
In logs I can see the following error:
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 ') ORDER BY wp_posts.post_date DESC LIMIT 0, 10' at line 1 of the WordPress database while executing a query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1 = 1 AND ((wp_posts.post_status = 'publish'))) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 sent by require (''), wp, WP-> main, WP-> query_posts, WP_Query-> query, WP_Query- > get_posts
I can see that there is one “)” but I have no idea where this function is being build and how can I fix it, since I am not an advanced user.
Do you have any ideas how I could fix it?
]]>Error_log contents:
[18-Sep-2022 07:12:37 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 '->posts} p WHERE p.post_status='publish'' at line 1 for query SELECT COUNT(*) FROM {$wpdb->posts} p WHERE p.post_status='publish' made by do_action_ref_array('sm_ping_daily'), WP_Hook->do_action, WP_Hook->apply_filters, GoogleSitemapGeneratorLoader::call_send_ping_daily, GoogleSitemapGenerator->send_ping_daily, GoogleSitemapGenerator->send_stats
[18-Sep-2022 13:54:54 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 '->posts} p WHERE p.post_status='publish'' at line 1 for query SELECT COUNT(*) FROM {$wpdb->posts} p WHERE p.post_status='publish' made by do_action_ref_array('sm_ping_daily'), WP_Hook->do_action, WP_Hook->apply_filters, GoogleSitemapGeneratorLoader::call_send_ping_daily, GoogleSitemapGenerator->send_ping_daily, GoogleSitemapGenerator->send_stats
[18-Sep-2022 19:04:22 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 '->posts} p WHERE p.post_status='publish'' at line 1 for query SELECT COUNT(*) FROM {$wpdb->posts} p WHERE p.post_status='publish' made by do_action_ref_array('sm_ping_daily'), WP_Hook->do_action, WP_Hook->apply_filters, GoogleSitemapGeneratorLoader::call_send_ping_daily, GoogleSitemapGenerator->send_ping_daily, GoogleSitemapGenerator->send_stats
]]>I already provided admin access to production site to mr. Mocanu but he never used it. They promised that correction to plugin will appear but it did not happened.
Maybe a button to recreate database tables for translate press would help because when you uninstall plugin the tables from translatepress persists in database and are not deleted as it should be.
]]>