How to Delete a database table row from Chronoform7 form?

hktanty 07 Aug, 2022
Hello,
I am a beginner and trying to learn form design using CF7. I have created a test form using "Basic Articles Demo form". I have changed the underlying database table to point to our table. I can see all the rows of that table and able to insert a new record and update an existing record. However I am not able to DELETE an existing record and failed to understand why it is not deleting the selected record. I have included the Debug details which shows that I am trying to delete row with ID=14. But shomehow, this ID is not getting passed to the DELETE SQL command.

Really appreciate if any one can help me to figure out this problem.

Array
(
    [chronoform] => AFTbenches-copy-20220807-061057
    [gpage] => delete
    [id] => 14
)
Array
(
    [delete_data_63] => Array
        (
            [result] => Data deletion failed!
            [log] => Array
                (
                    [0] => DELETE `Bench`.* FROM `aft_bench` AS `Bench` WHERE `Bench`.`id` = '';
                )

            [var] => 0
        )

)
Colnem 08 Aug, 2022
Hi

There is error in our syntax. Your id is null.

In your delete element you have to use a Where condition with id= {data:id}.
hktanty 08 Aug, 2022
Colnem,
Thank you for your response. Now it works with the Where condition. Very much appreciated.

Regards,

Hemanta
Post a Reply