KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Export result to mysql database table #3143

Open Komuraiah A opened this topic on on Sep 11, 2023 - 1 comments

Komuraiah A commented on Sep 11, 2023

Hi Team, Iam using php and mysql db, and i want a function or script that could export the report results from my datatable, so when i submit the button of my report (just like you provide csv, excel, and pdf format downloads), the data should import automatically to my mysql database chosen table.

Sebastian Morales commented on Sep 11, 2023

You would need to attach a click event listener to your Submit/Export button. In the listener function, you could get DataTables widget's full data with this command:

function ExportClicked() {
    var dtData = dataTables1.rows().data(); // "dataTables1" is the PHP id/name of the DataTables widget
    // Set dtData to either a hidden input's value and submit a form to export.php/export route
    // or add it to an ajax/xhr request's data and send the request to export.php/export route
}

Finally in your export.php/export route, get dtData, then test/check/sanitize/validate and insert them into your database.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None