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 #3028275
MYSQL query issues
Closed

Comments

  • Alex started the conversation

    Hello I am attempting to create a data table by the option "generate a query to the mysql database" I select the 3 variables of interest and the GUI tool generates the query: 

    SELECT beta5.`temperaturemin`,
           beta5.`temperature`,
           beta5.`temperaturemax`
    FROM beta5

    I then manually add the condition:

    SELECT beta5.`temperaturemin`,
           beta5.`temperature`,
           beta5.`temperaturemax`
    FROM beta5 ORDER BY id DESC LIMIT 25

    but I get an error message, there shouldn't be anything wrong with this query, is it incompatible with WPDataTables?

  •  1,894
    Miloš replied

    Hi, Alex

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    In some situations, using certain functions within SQL, the wpDataTables server has problems with parsing the query and building new queries dynamically (rarely happens, but does sometimes).

    Our logic is based on a PHP SQL parser which has full support for the SQL dialect for the following statement types

    SELECT, INSERT, UPDATE, DELETE, REPLACE, RENAME, SHOW, SET, DROP, CREATE INDEX, CREATE TABLE, EXPLAIN and DESCRIBE.

    Some of them are disabled for security reasons.

    Filtering, sorting, calculation functions and search may not work properly if you include:

    Accent graves ( ` ) around the table name JOIN functions UNION functions CONCAT functions sub-queries -

    • Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
    • Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of statement automatically when users trigger the sorting on the front-end, and having it in initial statement may cause the table to crash.

    -

    Perhaps you could try this modification:

    Remove the accent graves from the query ` ;

    and because you are setting the "FROM table_name", i would try like this :

    SELECT temperaturemin,
           temperature,
           temperaturemax
    FROM beta5

    Let me know if that helped, please. Thank you

    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 | 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