The table showed as it should, I could edit fields without any problem.
But when I put the short code in a page I receive this error
Notice: Undefined index: FROM in C:xampphtdocswp-contentpluginswpdatatablessourceclass.wpdatatable.php on line 1445
I left the query that Im using for your reference
SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends` INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id1` = `wpav_users`.`ID` WHERE `wpav_um_friends`.`user_id2` = %CURRENT_USER_ID% UNION SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends` INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id2` = `wpav_users`.`ID` WHERE `wpav_um_friends`.`user_id1` = %CURRENT_USER_ID%
SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends` INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id1` = `wpav_users`.`ID` WHERE `wpav_um_friends`.`user_id2` = %CURRENT_USER_ID% UNION SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends` INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id2` = `wpav_users`.`ID` WHERE `wpav_um_friends`.`user_id1` = %CURRENT_USER_ID%
Hi
I have a table that use a UNION tables.
The table showed as it should, I could edit fields without any problem.
But when I put the short code in a page I receive this error
Notice: Undefined index: FROM in C:xampphtdocswp-contentpluginswpdatatablessourceclass.wpdatatable.php on line 1445
I left the query that Im using for your reference
SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends`
INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id1` = `wpav_users`.`ID`
WHERE `wpav_um_friends`.`user_id2` = %CURRENT_USER_ID%
UNION
SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends`
INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id2` = `wpav_users`.`ID`
WHERE `wpav_um_friends`.`user_id1` = %CURRENT_USER_ID%
looking around to this line $tableName = $parsedQuery['FROM'][0]['table'];
When the query has an UNION key the $parseQuery should be $parsedQuery['UNION'][0]['FROM'][0]['table'];
https://ibb.co/0rqMdM3
Any comment?
this is validation that i did and it seems to work fine. I just want to know from you If it could cause any other problem or not.
/****************************************/
if(isset($parsedQuery['UNION']))
$tableName = $parsedQuery['UNION'][0]['FROM'][0]['table'];
else if(isset($parsedQuery['FROM']))
$tableName = $parsedQuery['FROM'][0]['table'];
/**********************************/
//$tableName = $parsedQuery['FROM'][0]['table']; <-- line 1501
Hello Alejandro
Can you please try adding "UNION ALL" at the end of the query?
Let me know if that works.
Kind Regards,
Aleksandar Vuković
[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
Hi
What do you mean? LIKE THIS
SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends`
INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id1` = `wpav_users`.`ID`
WHERE `wpav_um_friends`.`user_id2` = %CURRENT_USER_ID%
UNION
SELECT `wpav_um_friends`.*, `wpav_users`.`user_nicename` FROM `wpav_um_friends`
INNER JOIN `wpav_users` ON `wpav_um_friends`.`user_id2` = `wpav_users`.`ID`
WHERE `wpav_um_friends`.`user_id1` = %CURRENT_USER_ID%
UNION ALL
That's right, Alejandro
When using UNION in wpDataTables results in issues, adding "UNION ALL" at the end of the query, like in your example usually does the trick.
Kind Regards,
Aleksandar Vuković
[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