- To be honest, you are correct, this is more of a question of what's the best way to do this with an SQL Query directly on your database.
Depends if you want to pre-set a default field value, or set a value depending on some condition, etc.. There might be multiple solutions depending on what exactly you need.
For example, you can search useful sites such as stackoverflow.com.
Basically, first you would have to test if the SQL Query can successfully run on a Database manager such as PhpMyadmin, if it gives you the result you need there, and then you can try using it with our plugin. It is important to know this as well :
Our logic is based on a PHP SQL parser which has full support for the SQL dialect for the following statement types
Filtering, sorting, and search may not work properly if you include:
Accent graves ( ` ) around the table name
JOIN functions
UNION functions
CONCAT functions
sub-queries
To avoid any issues like that, you can try preparing a MySQL view (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″.
Hi,
Maybe it is a mysql question.... Is it possible to set a fieldvalue in the mysqlselect? And that this value is stored in the database?
Greetings,
Tim
Hi, Tim
Thanks for reaching out to us
- To be honest, you are correct, this is more of a question of what's the best way to do this with an SQL Query directly on your database.
Depends if you want to pre-set a default field value, or set a value depending on some condition, etc.. There might be multiple solutions depending on what exactly you need.
For example, you can search useful sites such as stackoverflow.com.
I found one working solution here : Conditionally set value of column in MySQL select query
or this one from Tutorialspoint.com : How to set a default value
or - How to set possible values for set field...
-
Basically, first you would have to test if the SQL Query can successfully run on a Database manager such as PhpMyadmin, if it gives you the result you need there, and then you can try using it with our plugin. It is important to know this as well :
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, and search may not work properly if you include:
To avoid any issues like that, you can try preparing a MySQL view (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″.
Here is a video showing an example of a MySQL View with our plugin.
- Sorry if that was too much details. I wanted to do my best to cover everything for you.
If anything is not clear, please let us know. Thanks.
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