This topic is locked

Before Delete Record, on Edit page

7/9/2010 10:40:48 AM
PHPRunner General questions
J
jansgroup author

I want to create a button on the view page (not the list page) that allows me to:
1.) Save the data record in another table

2.) and then deletes the current record, once saved into the new table.

A
ann 7/12/2010

Hi,
you can create button using Insert Button option on the Visual Editor tab.

Here is a sample code to save and delete a record (add to the Server tab):

$sql1 = "insert into AnotherTableName (field1, field2) select field1, field2 from TableName where ID=".$keys["ID"];

CustomQuery($sql1);

$sql2="delete from TableName where ID=".$keys["ID"];

CustomQuery($sql2);
J
jansgroup author 7/12/2010



Hi,
you can create button using Insert Button option on the Visual Editor tab.

Here is a sample code to save and delete a record (add to the Server tab):

$sql1 = "insert into AnotherTableName (field1, field2) select field1, field2 from TableName where ID=".$keys["ID"];

CustomQuery($sql1);

$sql2="delete from TableName where ID=".$keys["ID"];

CustomQuery($sql2);



where do i put this code, after i select Insert Button?
and do I need to change the "ID" values?

A
ann 7/13/2010

Hi,
add the code to the Server tab of the button. Also you need to replace field1, field2, ID fields with your actual field names.

J
jansgroup author 7/13/2010



Hi,
add the code to the Server tab of the button. Also you need to replace field1, field2, ID fields with your actual field names.


can i get an example of what ID would be?

A
ann 7/13/2010

Hi,
ID is your actual primary key field name (the one selected on the Datasource tables tab manually or created in the database).