This topic is locked
[SOLVED]

 Button to allow user to delete all data from specific tables

10/27/2017 8:50:55 AM
PHPRunner General questions
J
justmelat author

Hello:
In case of error, I want my users to be able to click a button and delete the data in two tables, that way they can just start over with fresh tables.
I have created/added a button in the visual editor screen, but it is not letting/showing me how to run a sql command [example: "delete from table1;" "delete from table2"?]. How can I accomplish this?

F
firecloud 10/27/2017



Hello:
In case of error, I want my users to be able to click a button and delete the data in two tables, that way they can just start over with fresh tables.
I have created/added a button in the visual editor screen, but it is not letting/showing me how to run a sql command [example: "delete from table1;" "delete from table2"?]. How can I accomplish this?




CustomQuery("truncate table1");

CustomQuery("truncate table2");
J
justmelat author 10/28/2017






CustomQuery("truncate table1");

CustomQuery("truncate table2");




but how do i get the button to execute the query, right now the custom buttons only seem to execute javascript.

H
headingwest 10/28/2017

The custom buttons have 3 tabs that fire in order

  • Javascript (get any data from the page and send to PHP)
  • PHP server side (database stuff)
  • Javascript (update page / refresh etc)
    So put it into the second tab

J
justmelat author 10/28/2017



The custom buttons have 3 tabs that fire in order

  • Javascript (get any data from the page and send to PHP)
  • PHP server side (database stuff)
  • Javascript (update page / refresh etc)
    So put it into the second tab



HI, I literally just saw those tabs, added my code, worked like a charm. Thanks alot.
NOTE: For those who maybe using sqlite3 use the sql statement "delete from tablename". Sqlite3 does not use truncate.