Please check the Editing tab above the table - "ID column for editing". That has to be a unique, auto-increment integer column that will store the edited rows into the database.
In the database table, you need to add a row ID column (a unique auto-increment column). You can do it using this query:
ALTER TABLE `youTableName`ADD COLUMN `id_column` INT AUTO_INCREMENT UNIQUE FIRST;
Then, in the Editing tab above the table, set this column to be the "ID column for editing", and it should work fine after that.
Thank you very much for the answer, if I have the primary key ID column and auto-incrementing in all the tables in my database. Something interesting is that if you edit "the row" but first the error message appears, then the table is disabled or it starts to reload (without response) and then when you refresh the page and see the database the row / element if it is edited . Case that does not happen when I want to add new rows to the table since the error jumps and the element is not added.
This photo shows the error that happens after editing a row.
Also I would like to add that the database that I am editing is not a wordpress database, it is any mysql database within the hosting.
Please provide me a temporary WP-admin (administrator) user for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue.
We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties.
You can write credentials here just check PRIVATE Reply so nobody can see them except us.
Make sure to tell us on which front-end page this table is located, and the database access for the database from where this table is being pulled.
Now you can modify and add new rows without this error appearing.
One advice, though, since you're pulling the data from a separate DB connection, and only one table (for example in table "Novedades"), you don't need the accent graves ( ` ) around the column names, nor do you need the table name in front of the column names, so you'll see that I changed your query from this:
I am trying to edit or insert rows in my MySQL database table with wpdatatables :( and I get this error.
Hi Arturo
Thank you for reaching out to us.
Please check the Editing tab above the table - "ID column for editing". That has to be a unique, auto-increment integer column that will store the edited rows into the database.
In the database table, you need to add a row ID column (a unique auto-increment column). You can do it using this query:
Then, in the Editing tab above the table, set this column to be the "ID column for editing", and it should work fine after that.
Hello Blaženka,
Thank you very much for the answer, if I have the primary key ID column and auto-incrementing in all the tables in my database. Something interesting is that if you edit "the row" but first the error message appears, then the table is disabled or it starts to reload (without response) and then when you refresh the page and see the database the row / element if it is edited . Case that does not happen when I want to add new rows to the table since the error jumps and the element is not added.
This photo shows the error that happens after editing a row.
Also I would like to add that the database that I am editing is not a wordpress database, it is any mysql database within the hosting.
Hello Arturo
Sorry for the late response.
Please provide me a temporary WP-admin (administrator) user for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue.
We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties.
You can write credentials here just check PRIVATE Reply so nobody can see them except us.
Make sure to tell us on which front-end page this table is located, and the database access for the database from where this table is being pulled.
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
Thank you Arturo.
We found the issue. The detailed error is this:
Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/u112784341/domains/sdsconsultores.com/public_html/wp-content/plugins/wpdatatables/source/class.sql.php:271 Stack trace: #0 /home/u112784341/domains/sdsconsultores.com/public_html/wp-content/plugins/wpdatatables/source/class.sql.php(271): mysqli_num_rows() #1 /home/u112784341/domains/sdsconsultores.com/public_html/wp-content/plugins/wpdatatables/source/class.sql.php(99): PDTSql->prepare() #2 /home/u112784341/domains/sdsconsultores.com/public_html/wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php(475): PDTSql->doQuery() #3 /home/u112784341/domains/sdsconsultores.com/public_html/wp-includes/class-wp-hook.php(303): wdtSaveTableFrontend() #4 /home/u112784341/domains/sdsconsultores.com/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #5 /home/u112784341/domains/sdsconsultores.com/public_html/wp-includes/plugin.php(470): WP_Hook->do_action() #6 /home/u112784341/domains/sdsconsultores.com/public_html/wp-admin/admin-ajax.php(187): do_action() #7 {main} thrown in /home/u112784341/domains/sdsconsultores.com/public_html/wp-content/plugins/wpdatatables/source/class.sql.php on line 271
It's coming from PHP version 8.0.7. and we will fix the issue in our next update.
Until then, I modified the file ../wp-content/plugins/wpdatatables/source/class.sql.php and modified this:
With this:
Now you can modify and add new rows without this error appearing.
One advice, though, since you're pulling the data from a separate DB connection, and only one table (for example in table "Novedades"), you don't need the accent graves ( ` ) around the column names, nor do you need the table name in front of the column names, so you'll see that I changed your query from this:
To this:
It works fine now. Sorry for the delay, by the way!
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
I really appreciate your help Aleksandar.
OK Aleksandar I'll do it right now.
Thank you so much for everything.