I try to run a simple query with a date condition and it fails.
SELECT first_name, last_name, id FROM wp_participants_database WHERE DATE(date_adhesion_converted) < '2018-01-01'
I have other queries using this condition without any problem but this one is causing this Error :
wpDataTables backend error: No data fetched! Rendered query: SELECT first_name, last_name, id FROM wp_participants_database WHERE DATE(date_adhesion_converted) < '2018-01-01' LIMIT 10 MySQL said: 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 ''2018-01-01' LIMIT 10' at line 1 This usually happens when the MySQL query returns an empty result or is broken. Please check the results of the query in some DB manager (e.g. PHPMyAdmin)
Can you please tell me does that query works in phpMyAdmin or any other database management system. If it is working please use it as data input to create "Add from data source" -> MySQL table. If you still have problem with table create MySQL VIEW from that query and that should work.
This query works in phpMyadmin and also with "SQL executioner" plugin directly on the website. I use it as input with "Add from data source" / MySQL table but it fails.
I don't want to use Views as it reminds me previous versions of wpDataTables plugin where it was oring to do so.
Do you have any other idea to use this query (which is working in another "old/previous" table) ?
Indeed when changing the < by a > the query works well. But that's not what I wanted to do... so I changed my query to SELECT first_name, last_name, id FROM wp_participants_database WHERE '2018-01-01' > DATE(date_adhesion_converted) and it worked !!!
So this trick is OK, but if you have a better solution, I ready to test it.
If that is the case the you can fix issue by changing this part of the code. In file ../wp-content/plugins/wpdatatables/controllers/wdt_admin_ajax_actions.php find:
You are welcome. Yes it will be added in the next release. We'd greatly appreciate it if you could take a minute and leave a review on CodeCanyon on this link. Thanks!
Hello,
I try to run a simple query with a date condition and it fails.
SELECT first_name, last_name, id FROM wp_participants_database WHERE DATE(date_adhesion_converted) < '2018-01-01'
I have other queries using this condition without any problem but this one is causing this Error :
wpDataTables backend error: No data fetched!
Rendered query: SELECT first_name, last_name, id FROM wp_participants_database WHERE DATE(date_adhesion_converted) < '2018-01-01' LIMIT 10
MySQL said: 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 ''2018-01-01' LIMIT 10' at line 1
This usually happens when the MySQL query returns an empty result or is broken. Please check the results of the query in some DB manager (e.g. PHPMyAdmin)
Could you tell me what is wrong ?
Thanks
Severin
Hi Severin,
Thank you for your purchase.
Can you please tell me does that query works in phpMyAdmin or any other database management system. If it is working please use it as data input to create "Add from data source" -> MySQL table.
If you still have problem with table create MySQL VIEW from that query and that should work.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello Bogdan,
This query works in phpMyadmin and also with "SQL executioner" plugin directly on the website.
I use it as input with "Add from data source" / MySQL table but it fails.
I don't want to use Views as it reminds me previous versions of wpDataTables plugin where it was oring to do so.
Do you have any other idea to use this query (which is working in another "old/previous" table) ?
Severin
Hi bleu34,
Can you try to change < to > and see does that query works. If that is the case I maybe know where is the issue without logging in into your website.
Very funny bug ;-)
Indeed when changing the < by a > the query works well. But that's not what I wanted to do... so I changed my query to
SELECT first_name, last_name, id FROM wp_participants_database WHERE '2018-01-01' > DATE(date_adhesion_converted)
and it worked !!!
So this trick is OK, but if you have a better solution, I ready to test it.
Hi bleu34,
If that is the case the you can fix issue by changing this part of the code. In file ../wp-content/plugins/wpdatatables/controllers/wdt_admin_ajax_actions.php find:
and replace it with:
It works thanks Milos !
I guess it will be integrated in next release. You can close this ticket. Thanks
Severin
Hi Severin,
You are welcome. Yes it will be added in the next release. We'd greatly appreciate it if you could take a minute and leave a review on CodeCanyon on this link. Thanks!