Okay
  Public Ticket #1987521
sql source
Closed

Comments

  • Jay started the conversation

    I'd like to know if I can write my own SQL query to populate a table with information from post meta values, then allow front-end editing to those fields. Is it possible to pull this data in dynamically, then edit and save it back to the database?


    Thank you.

  •  2,514
    Aleksandar replied

    Hello Jay.

    Thank you for your interest in our plugin.

    You can create your own query, of course. But there are some limitations to this.

    Please take a look at our documentation about front-end editing. While you can edit SQL query based tables both in front-end and in back-end, only one MySQL table can be edited at a time. Queries from multiple tables with joins cannot be used as an editable feature, since SQL UPDATE and INSERT statements are generated automatically, and there currently is no way to update multiple tables – but this problem is being investigated and pursued.

    If you're pulling the data out of one SQL table, then you should be able to edit those entries without much issues.

    My advice would be to visit our sandbox site and add your database in the main settings, as a separate DB connection. Then you can then create a new table using that separate DB connection, and see if it will pull all data and edit it properly.

    1087372036.png

    wpDataTables is a WYSIWYG (What You See Is What You Get) concept based plugin, so if you're able to edit it in back-end - you will be to edit it in front-end as well.

    Please let me know if you have any more questions.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    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

  • Jay replied

    Thanks, this was helpful. Unfortunately, I need to update both wp_posts and wp_postmeta tables (you've probably encountered users who want to do this before). If there are any advancements or updates which tackle this, I'd be very interested.

    Thanks again, great plugin.

  •  2,514
    Aleksandar replied

    Hello again Jay.

    You can try preparing a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTables based on a simple query like “SELECT * FROM view1″.

    Please note some this when working with the server-side processing feature:

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

    I cannot say that it will work 100%, but you can definitely try.

    Personally, I created a view from 3 tables and was able to edit them all. On another occasion, I created a view from 2 tables, and wasn't able to edit the second one.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    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