I can save sucessfully the table with the SQL-Statement. However, the table never shows a result because the script crashes and throws an excpetion in class.wpdatatable.php on line 2605.
WP-Log:
PHP Fatal error: Uncaught TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in .../public_html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php:2605 Stack trace: #0 .../public_html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php(2605): array_unshift() #1 .../public_html/wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php(247): WPDataTable->queryBasedConstruct() #2 ... public_html/wp-includes/class-wp-hook.php(308): wdtGetAjaxData() #3 .../public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #4 .../public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #5 .../public_html/wp-admin/admin-ajax.php(188): do_action() #6 {main} thrown in .../public_html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php on line 2605
The same select statement succeeds in phpmyadmin and gives the currect result set.
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.
-
Our plugin is not a database management tool, and is not meant to be used as one;
that is why you are able to run this specific Query in your PhPMyAdmin,
we will elaborate more on the SQL logic from our plugin.
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
-
So, first you can check for accent graves around the table name, if you have this, remove it...
Then, see if you used CONCAT to create any column.
If so, go into this column setting, and disable it from "global search" in the Filtering tab.
-
-
If none of that helps,
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″.
If you need help with that, you can see our video, where we show an example of using View in our plugin.
I can save sucessfully the table with the SQL-Statement. However, the table never shows a result because the script crashes and throws an excpetion in class.wpdatatable.php on line 2605.
WP-Log:
PHP Fatal error: Uncaught TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in .../public_html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php:2605
Stack trace:
#0 .../public_html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php(2605): array_unshift()
#1 .../public_html/wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php(247): WPDataTable->queryBasedConstruct()
#2 ... public_html/wp-includes/class-wp-hook.php(308): wdtGetAjaxData()
#3 .../public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#4 .../public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#5 .../public_html/wp-admin/admin-ajax.php(188): do_action()
#6 {main}
thrown in .../public_html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php on line 2605
The same select statement succeeds in phpmyadmin and gives the currect result set.
-------------------------------------------------------------------------------------------
SELECT posts_post.ID AS post_ID
FROM wp_posts AS posts_post
WHERE posts_post.id = "%CURRENT_POST_ID%"
UNION
SELECT ID
FROM wp_posts
WHERE post_type = 'comments'
UNION ALL
Does anyone know how to solve the problem?
Thanks
Thomas
Hi, Thomas.
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.
-
Our plugin is not a database management tool, and is not meant to be used as one;
that is why you are able to run this specific Query in your PhPMyAdmin,
we will elaborate more on the SQL logic from our plugin.
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:
-
So, first you can check for accent graves around the table name, if you have this, remove it...
Then, see if you used CONCAT to create any column.
If so, go into this column setting, and disable it from "global search" in the Filtering tab.
-
-
If none of that helps,
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″.
If you need help with that, you can see our video, where we show an example of using View in our plugin.
-
Let us know if that helps.
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 | 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