We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #1067084
mySQL query with date Error!
Closed

Comments

  •  2
    Séverin started the conversation

    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

  •  1,894
    Miloš replied

    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ć
    milos.jovanovic@tmsproducts.io

    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 | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  •  2
    Séverin replied

    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

  • [deleted] replied

    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.

  •  2
    Séverin replied

    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.

  • [deleted] replied

    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:

    $table_content = sanitize_text_field($_POST['table_content']);

    and replace it with:

    $table_content = $_POST['table_content'];


  •  2
    Séverin replied

    It works thanks Milos !

    I guess it will be integrated in next release. You can close this ticket. Thanks

    Severin

  • [deleted] replied

    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!