I was wondering if it is possible to display sql table data using parameterized sql statements whose parameters are filled with parameters submitted on the URL or in a real-time editable form text box?
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.
-
If you mean to have a 'dynamic SQL Query based Table' , which can have its 'default Query' in our Plugin, but to be able to change it via a parameter from URL sent by an API or PHP;
We don't have a built-in solution, but if you have coding skills, we can advise what you can try.
You can take a look at our available filters for developers here ;
but combining these two or perhaps even just by using that hook/filter,
you might be able to achieve this use-case.
We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet, so at this time you can only try to make a custom solution to make this work.
SELECT * FROM yourDatabaseTable
WHERE columnName = '%VAR1%'
%VAR1% can be defined in the Placeholders tab when you're creating a table,
or you can pass a different VAR1 value in the table's shortcode.
-
2. Or, if you don't add the condition in an SQL query ( or don't use an SQL Table),
you can add %VAR1% in column settings -> Filtering, under "Predefined filtering value".
Then, you can have different versions of the same table, with the VAR1 value passed in the shortcode,
let's say if we had a "Regions" column and we wish to filter a different region per each page.
If we want page 1 for example only filtered for "Region A" , you can set predefined filter to this column as %VAR1% (filter type has to be set as text) :
Then for a page where we need only Region 1 filtered, use shortcode [wpdatatable id=1 var1='Region A'] ,
page 2 for only "Region B", shortcode would be [wpdatatable id=1 var1='Region B'] and so on,
to apply the values defined in the shortcode to the filter.
( This filtering method can be used for any table type, besides Simple Tables)
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
I was wondering if it is possible to display sql table data using parameterized sql statements whose parameters are filled with parameters submitted on the URL or in a real-time editable form text box?
Hi Drew,
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.
-
If you mean to have a 'dynamic SQL Query based Table' , which can have its 'default Query' in our Plugin, but to be able to change it via a parameter from URL sent by an API or PHP;
We don't have a built-in solution, but if you have coding skills, we can advise what you can try.
You can take a look at our available filters for developers here ;
https://wpdatatables.com/documentation/information-for-developers/filters/
-
They pointed out this one :
wpdatatables_filter_mysql_query( $query, $tableId )
because you can use that to manipulate the Query.
There is also an option with Placeholders,
but combining these two or perhaps even just by using that hook/filter,
you might be able to achieve this use-case.
We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet, so at this time you can only try to make a custom solution to make this work.
I hope this helps.
Here you can check out our general Documentation how our SQL Query Tables are made.
And when it comes to pre-defining filtering for our SQL Tables, we will also share some examples if that might help.
There can be different ways to pre-filter tables in our plugin :
If you wish to try Pre-filtering tables through URL, please check out this page with examples.
-
You can also use placeholders for table generation.
1. For example, if you have a MySQL query-based table, you can use this query:
%VAR1% can be defined in the Placeholders tab when you're creating a table,
or you can pass a different VAR1 value in the table's shortcode.
-
2. Or, if you don't add the condition in an SQL query ( or don't use an SQL Table),
you can add %VAR1% in column settings -> Filtering, under "Predefined filtering value".
Then, you can have different versions of the same table, with the VAR1 value passed in the shortcode,
let's say if we had a "Regions" column and we wish to filter a different region per each page.
If we want page 1 for example only filtered for "Region A" , you can set predefined filter to this column as %VAR1% (filter type has to be set as text) :
Then for a page where we need only Region 1 filtered, use shortcode [wpdatatable id=1 var1='Region A'] ,
page 2 for only "Region B", shortcode would be [wpdatatable id=1 var1='Region B'] and so on,
to apply the values defined in the shortcode to the filter.
( This filtering method can be used for any table type, besides Simple Tables)
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Let me know if you have any additional questions.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
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