Custom button that runs SQL Query
Custom button that runs SQL Query
Hey there,
I have been stuck on this problem for a few days now and I think it's time to consult the forms. Essentially, this is my end goal:
1. Datatable displays data from SQL Server (complete -- using PHP)
2. Let users select certain rows within the table (complete)
3. Create a list of rows selected using the RowFilter column (unique ID for each row)
4. Let users click 'Mark as Complete' button, which updates all the rows selected previous in our SQL server, essentially just adds a flag to a column.
I'm currently stuck on steps 3 and 4. Is there a way to essentially attach a command to run a SQL query to a button, and use the selected rows as part of the query? Any help would be appreciated.
This question has an accepted answers - jump to answer
Answers
Are you using the Select extension?
If so this example shows how to get the selected rows.
https://datatables.net/extensions/select/examples/api/get.html
You would change the example to use
rows().data()
to get the row data.Once you have the row data then you would then use jQuery Ajax to send the data to your server URL that will perform the SQL query.
Kevin
Thank you!
I will take a look at those links and get back to you if I run into issues.